I have a maven project A which uses jar files of another project B at version 1.0 of my team. The version 1.0 of project B has been submitted to the local Maven repository.
The problem is that project B does not include source code. So in project A, I right-click on the JAR B under Maven Dependencies in the Package Explorer, select Java Source Attachment and setup the Location path at project B (at version 1.1, I don't have the previous version source anymore) source folder (xxx/projectB/src/main/java/). But it seems like Maven doesn't find any source class.
A couple ways to solve this:
Since you're using m2eclipse, you can then right-click on the project, then select Maven > Download Sources.
Add to your B pom (I think one of them should work):
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With