Reputation: 71
I have just added dependencies to an eclipse project so that my jar can see other jars. How can I be sure that the dependencies work, and that what I've done is correct? I view a pom.xml file that has been created so what are the target folder and classes,test-classes subfolders used for? Thanks
Upvotes: 0
Views: 2747
Reputation: 18236
If you added your dependencies correctly your application should build and execute correctly, or am I missing something? Dependencies should be added to a POM section that looks like this example:
<dependencies>
<dependency>
<groupId>annogen</groupId>
<artifactId>annogen</artifactId>
<version>0.1.0</version>
</dependency>
<!-- other dependencies here -->
</dependencies>
Maven and the m2e/m2eclipse plugin rely on source files to be conventionally placed in src/main/java
for application code and src/test/java
for test code. Application code is compiled to target/classes
and test code is compiled to target/test-classes
. If you plan to use Maven and/or m2e/m2eclipse, do read about it. Maven: The Complete Reference is a good starting point.
Upvotes: 0
Reputation: 45616
If you use m2e
, it adds Maven Dependencies
pseudo library to your project.
You may expand it and see if the dependent jar file is in there.
If it is, Eclipse ( or more precisely m2e ) has resolved the dependency correctly and it's available for you project build.
Upvotes: 1
Reputation: 5032
If you have the m2eclipse plugin installed you can open your pom in Eclipse and click on the Dependency Hierarchy tab to view your resolved dependencies. You should manage all dependencies through Maven with the setup you are describing.
If you want to check command line you may want to look at using Effective Pom.
Upvotes: 1