How to install Maven artifact with sources

February 24, 2021 | No comments

How to install Maven artifact with sources

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 do I generate source code for third-party artifacts that my project is using. 
2) How do I 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
Generate source code for project
Following commands will generate the sources jar under the target folder for the project.
mvn source:jar install

No comments :