How to install Maven artifact with sources?
so later I don't need to open a project in eclipse to see some code.
EDIT: I do know I can add to pom.xml this code
<plugin> <artifactId>maven-source-plugin</artifactId> <executions> <execution> <id>attach-sources</id> <phase>verify</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin>
but I would like to do it from command line(to make it more universal).
To download sources for dependencies of maven project, right click on project → Maven → Download Sources . Similarly to download JavaDoc for dependencies of maven project, right click on project → Maven → Download JavaDoc .
Download Jar From maven.org. There is another maven repository that you can download jar files from. Open a web browser and browse the URL maven.org or search.maven.org. Input the jar library group name or artifact name in the search box, it will list all matched jar libraries.
You can use the Maven Dependency Plugin to download dependencies. Run mvn dependency:copy-dependencies , to download all your dependencies and save them in the target/dependency folder. You can change the target location by setting the property outputDirectory .
To download sources for your dependencies:
mvn eclipse:eclipse -DdownloadSources=true
To attach sources to an installation:
mvn source:jar install
It's also preferable to use the goal source:jar-no-fork
in your pom as described on the maven-source-plugin page.
Simple, get your sources and JavaDocs:
mvn dependency:resolve -Dclassifier=javadoc mvn dependency:resolve -Dclassifier=sources
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