I want to use Choco 3.3.1 in my eclipse project. I added the needed jar file to the java build path. But in the readme file it says that I also need to add the required dependencies. They look like this:
org.javabits.jgrapht:jgrapht-core:jar:0.9.3
dk.brics.automaton:automaton:jar:1.11-8
args4j:args4j:jar:2.32
net.sf.trove4j:trove4j:jar:3.0.3
org.slf4j:slf4j-api:jar:1.7.13
Where can I add those without maven, gradle etc.?
(The project is a scala project, but I don't think that's the problem)
The easiest way is probably to locate and download them from the Maven Central repository. You can search by artifact and/or group ID and locate the exact version(s) you're looking for. For example, here's the search for the jgrapht JAR.
Having said that, why not use Gradle, which has Scala support? Or sbt, the Scala build tool? You should at least give those some consideration.
Related
I'm using an Eclipse project and don't want to use a Maven pom. I want to drop the jars needed for Mockito into a directory and reference them from Eclipse build properties. But Mockito.org doesn't supply a download link nor mention what jars are needed to get Mockito running.
How do I determine what jars I need to download?
Mockito.org is mysteriously evasive about what Jars are needed for specific releases. They really want people using the .pom, but sometimes we don't wanna use Maven. (Developers are capricious and stubborn after all.)
Here's how to derive what jars you'll need if you're willing to read a .pom:
Go to Maven.org and type "mockito" into the search box. Look for the latest version of a "mockito*" in the "artifact ID" column. Decide which .jar "looks right." In this case I used mockito-core. Click on the "jar" link and now you've got your first jar.
But you need to get the dependencies:
Click on the link to the .pom and look at the listed dependencies. You'll see listed artifact-ids such as byte-buddy, byte-buddy-agent, and objenesis.
Using the maven.org search box, enter in the artifact-id and download the jar for each of them. Put them all together in a directory and change your build properties so you can use Mockito in your Eclipse project.
Basically you are looking for
mockito-core.jar
and on top of that, you also want:
mockito-core-sources.jar
mockito-core-javadoc.jar
It often helps to have the source code, or at least the javadoc content at your fingertips within your IDE.
I've googled on it and I've seen a lot of different sites that offers the struts2-junit-plugin.
I'm currently using struts-2.2.1.1. Should I get struts2-junit-plugin-2.2.1.1 as well?
Also, my project doesn't use Maven. When I downloaded a struts2-junit-plugin, I inspected the .jar file and found a pom.xml containing all of its dependencies. Should I separately download all these dependencies manually since I don't use Maven?
Yes, you should use the matching junit-plugin version (2.2.1.1)
Yes, but you also need to load the dependencies' dependencies, the dependencies' dependencies' dependencies ad nauseam until you're at the end.
Point 2 is why you really should be using Maven or similar mechanism.
Getting dependencies by hand is error-prone, tedious, and silly.
I want to create a simple RDF graph and then try simple querying using SPARQL. Since I'm familiar with java and net beans, I want to use Apache Jena on NetBeans. I downloaded the related files from http://www.apache.org/dist/jena/ .
What should I do next to write RDF codes on net beans? i.e Should I install something or add lib files/jar files somewhere?
(Too long for a comment on Ian's reply)
Maven is easy on netbeans, and a good way to get started with everything you need (as Ian says). Here's a quick guide to start a jena project:
File -> New Project. Choose Maven then Java Application.
Pick project name, location, etc., then Finish.
Netbeans will create a new maven project and open it.
Right click on Dependencies, choose Add Dependency....
Use org.apache.jena as the Group ID, jena-core (or jena-arq if you want SPARQL) as the Artifact ID, and 2.10.1 as the Version.
Open the Dependencies folder. It ought to have a number jars present -- these are jena and its required jars. You might need to right-click on Dependencies again and choose Download Declared Dependencies to ensure jena is ready for use.
Under Source Packages you'll find App.java. Try some of the simple jena api tutorials and try running them.
You need to put the .jar files from the Jena distribution where Netbeans will find them. I don't know Netbeans, but in Eclipse I might have a lib directory in my project top-level directory, and then set the Eclipse's project classpath to include each of those .jar files. Netbeans I'm sure has something similar.
Actually what I do in Eclipse is not use downloaded jars at all, but I would use Maven to manage the dependencies for me. So I would create a pom.xml file in my project folder that stated that, among other things, my project depends on Jena, and then Maven takes care of downloading the dependencies for me. Eclipse and Maven work well together; I'd hope the same would be true of Netbeans. Setting up Maven to use Jena is described on the Jena site. However, learning Maven can be a bit of a steep curve, so if you're not ready to take that on just yet then downloading the .jar files to a project lib directory is the way to go.
I'm added a dependence to my build.sbt (casbah). I did a sbt update, I did check my ~/.ivy2/cache directory and all jars are there. Do I have to add this ~/.ivy/cache directory to my Build Path and add the casbah as external Jar to my project? If no, probably no because I did try it, what should I do to be able to use this jar in my scala project?
EDIT
I found this instructions that helped me, but still a hack
Establish a simple project (general/project) named "IvyCache"
located at your ".ivy2/cache" folder just for library reference
purposes.
Establish a Scala project located at your "project" folder.
Add the following libraries to the Scala project by means of "Add
JARs" to the "Java Build Path":
3.a) All jars from "/IvyCashe/org.scala-tools.sbt" filterred by
"*2.9.1-0.11.2" or any other Scala/SBT version numbers.
3.b) A single sbinary_*.jar from "/IvyCache/org.scala-tools.sbinary".
3.c) A single test-interface*.jar from "/IvyCache/org.scala-
tools.testing".
Now your build files should compile within Eclipse.
The easiest way to manage this is to use the eclipse plugin for sbt. Then you can just say sbt eclipse on the command line any time you change the dependencies in build.sbt, and the Eclipse files will be automatically updated for you.
Doing it this way means that you will never have to manually configure your Eclipse build path. After all, sbt already knows how to construct the build path, so there's no reason you would have to do it manually.
I have a dependency on clj-record in my CounterClockwise project. What's the best way to manage this? Copy the source code or compile to a JAR and add it as a referenced library?
There are tools to help you:
http://github.com/technomancy/leiningen <- project based
http://github.com/liebke/cljr <- dependencies not project based
http://github.com/ninjudd/cake <- alternative build tool
Assuming your dependencies are available in a Maven repo (like central or clojars), you have a couple of options.
First, if you're using Leiningen, there is an eclipse plugin for it now that will manage project dependencies for you, based on the dependencies you define in your project.clj file. The plugin is in beta now, but has been working great for me so far. (Note that it uses Leiningen 2.0 under the covers, though that detail won't matter for many (most?) simple cases.)
If you're using Maven, the m2eclipse plugin makes it so that the dependencies you declare in your Maven pom.xml are automatically added to your eclipse project's build path, and are therefore available in CCW REPLs and such.
there seems to be no pattern for specifying dependencies apart from hacking the code into your project or building a jar externally.
Of course you can, just as with any java project. While dependency resolution isn't tied into eclipse (yet), once you retrieve the deps (via one of the command line tools nickik listed), you can specify which jars are to be included in the java build path of your eclipse project:
Retrieve the deps via cake, leiningen, etc.
Refresh the eclipse project so you see the deps (usually in the lib directory)
Highlight the jars you want eclipse to know about
Right-click, select Build Path > Add to Build Path
That's it. You can fiddle with the build path by going to the Java Build Path section of the project's properties window.