-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need help for initial compile with Maven #101
Comments
At present there is an issue with the release process between the develop and master branches that results in a snapshot being present on the master branch. To build the 1.6.0 release you need to rewind your git checkout to hash:
This will have the effect of creating a detached HEAD which is fine for you when building, but not so fine when committing. Alternatively, you can just include the 1.6.0 version in your own project as a Maven dependency:
|
You have two options:
|
Dear Gary and Tim, thank you very much for your help. I cloned the development branch again, did a Now I am trying to start the TickerDemo...it has been a long time ago with java, but I do remeber the classpath pain... cd xchange-examples/target Exception in thread "main" java.lang.NoClassDefFoundError: com/xeiam/xchange/ExchangeFactory I guess I have to include more jars in the classpath, but they are all in different directories? Should I collect all the jars in one folder? Or is there a completely new and different way how to run classes? |
You really are doing this the hard way if you're not using an IDE for this. You can get Intellij for free and it will take all this pain away. You'd just right click on the TickerDemo.main() method and select Run As... | Application. Maven takes away all the classpath pain of Java. The problem you have is that you're missing the module(s) for the exchange(s) that you want to connect to. In your project you'd add
to get the MtGox exchange API added. You can add more as you want. To run this up from the command line you'll need to add the JARs to your classpath. There are so many that I honestly wouldn't recommend this approach. |
Ok, I installed IntelliJ and now I am able to run the demos. Thank you very much! My plan with XChange is to ultimately run it as a "demon" on a server for polling market data. It seemed that I could get around learning Tomcat and just have a cronjob starting a java file which writes to a database. Is that a bad idea? Or better, is there a recommendation how to run XChange on a server? |
What are your plans with the server? Just to sink marketdata in a DB for another application to access? Or are you planning on making the data available via a REST API or something similar over HTTP? |
For now, sinking data into a DB for another application. But I might be interested into streaming/ sockets in the future...a REST API is not planned, unless there would be a good reason for it. |
For just sinking data into a DB you definitely don't need Tomcat and all that complication. Your idea of CRON running a script to start a Java "job" is good and simple. I do it similarly, but I use Sundial instead, which let's you basically run jobs in a Java App using cron expressions defined in a jobs.xml file. It's all more encapsulated that way. Sundial is just a simplified fork of the Quartz job scheduler for Java. You could use Quartz though if you wanted with the same result. It'd be a steeper learning curve, that's all. |
Gary and Tim, that has been a tremendous help to get me started! |
Hello,
my Java knowledge is a bit rusty and I am trying to catchup with this maven thing.
First I tried to run the TickerDemo from the release jars and then snapshot jars. Those failed with the same problem as in
#75
I tried to get the missing lib with
org.slf4j:slf4j-api:jar:1.7.2:compile
but that couldn't find the library apparently.
So I followed the advice in #75 and went with maven.
I cloned the latest git repo and installed maven 3.0.3.
Then I edited the pom.xml by adding the and elements.
I tried to add under the root element, but that failed. Then I tried to add that element to because there is another repository there, that failed too.
So I created a new element , as it is mentioned in the pom-Documentation:
sonatype-oss-snapshot
https://oss.sonatype.org/content/repositories/snapshots
I then did
mvn clean install
which fails with this output:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] XChange Parent .................................... SUCCESS [2.273s]
[INFO] XChange Core ...................................... SUCCESS [7.929s]
[INFO] MtGox Exchange .................................... SUCCESS [7.764s]
[INFO] VirtEx Exchange ................................... SUCCESS [3.824s]
[INFO] Open Exchange Rates ............................... SUCCESS [3.738s]
[INFO] BTCE Exchange ..................................... FAILURE [1.675s]
[INFO] Bitstamp Exchange ................................. SKIPPED
[INFO] Campbx Exchange ................................... SKIPPED
[INFO] Bitcoin Charts Data Provider ...................... SKIPPED
[INFO] XChange Examples .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.492s
[INFO] Finished at: Mon Apr 29 12:14:25 CEST 2013
[INFO] Final Memory: 15M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.13:test (default-test) on project xchange-btce: There are test failures.
Now I am unsure how to proceed. Could anyone give me a hint what to try next?
The text was updated successfully, but these errors were encountered: