0

I'm trying to download the source code from a .jar file. I know about mvn dependency:sources but I don't have access to the jar's pom.xml file to run that command.

What I am trying to accomplish: I have two separate projects (Project_1 and Project_2). Project_1 has a dependency on Project_2 in which a version of Project_2 is downloaded from Nexus. I am adding

<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>

into the Project_2 pom file. How then will I be able to download the source jar file to Project_1 if all I have is the dependency to Project_2? I have no access from Project_1 to the Project_2 pom to run the command.

16
  • is the sources jar available in Nexus as well? When project2 is deployed on Nexus, is also its sources jar deployed? Commented Apr 26, 2016 at 20:50
  • 1
    @A.DiMatteo When Project_2 goes through a build, it's my understanding that Nexus it will be available in Nexus automatically Commented Apr 26, 2016 at 21:04
  • not necessarely, the deploy phase will not attach the sources jar automatically, unless the pom file will specify so. Browsing your Nexus repository, do you see the sources jar under the project2 directory where you actually also see the final jar? Commented Apr 26, 2016 at 21:05
  • Side-note, the sources JAR, if present, should have a name like ...-sources.jar. If this artifact was released with the maven-release-plugin, it should have created a sources JAR. But the fact that you do not have the POM is concerning. How did you obtain that JAR in the first place? Commented Apr 26, 2016 at 21:20
  • @A.DiMatteo No because I have not deployed yet. Would you be able to answer both scenarios? 1) The source jar shows up in Nexus 2) The source jar does not show up in Nexus Commented Apr 26, 2016 at 21:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.