How to install Maven artifact with sources

How to download source for maven artifacts

Maven builds a project using its project object model (POM) and a set of plugins. Dependencies used by the project are mentioned in the pom.xml file. We can also get the dependencies artifact from maven along with source codes.

In the following section, we will cover two use cases
1) How to generate source code for third-party artifacts that my project is using
2) How to generate source code for my project
Download sources for third party artifacts
Executing the following command from the terminal will download the sources for all the artifacts for the project and will attach it to Eclipse IDE.
mvn eclipse:eclipse -DdownloadSources=true
Executing the following command from the terminal will download the sources for all the artifacts only, attaching the sources in the IDE with the binaries needed to be done seperately..
mvn dependency:sources -Dsilent=true
Generate source code for project
This command will generate the sources jar under the target folder for the project.
mvn source:jar install

No comments :

Post a Comment

Please leave your message queries or suggetions.