How to install Maven artifact with sources from command line?

JavaEclipseMaven

Java Problem Overview


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

Java Solutions


Solution 1 - Java

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.

Solution 2 - Java

Simple, get your sources and JavaDocs:

mvn dependency:resolve -Dclassifier=javadoc
mvn dependency:resolve -Dclassifier=sources

Solution 3 - Java

Please use mvn source:jar install to install the Maven artifacts.

Solution 4 - Java

It is quite easy with eclipse, right click the project in project explorer view, click maven menu item , then click download sources..

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionIAdapterView Question on Stackoverflow
Solution 1 - JavadogbaneView Answer on Stackoverflow
Solution 2 - JavaJoseph LustView Answer on Stackoverflow
Solution 3 - JavaVenky VungaralaView Answer on Stackoverflow
Solution 4 - JavaGursel KocaView Answer on Stackoverflow