IAdapter
IAdapter

Reputation: 64915

How to install Maven artifact with sources from command line?

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

Upvotes: 104

Views: 75016

Answers (4)

Venky Vungarala
Venky Vungarala

Reputation: 1195

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

Upvotes: 4

Joseph Lust
Joseph Lust

Reputation: 20015

Simple, get your sources and JavaDocs:

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

Upvotes: 71

dogbane
dogbane

Reputation: 274878

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.

Upvotes: 181

Gursel Koca
Gursel Koca

Reputation: 21300

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

Upvotes: -2

Related Questions