How to install Maven artifact with sources from command line?

0 votes

How to install Maven artifact with sources?

so later I don't need to open a project in eclipse to see some code.

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).How to do that?

Jun 3 in Java by kartik
• 16,160 points
114 views

1 answer to this question.

0 votes

Hello @kartik,

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.

Thank You!!

answered Jun 3 by Niroj
• 33,440 points

Related Questions In Java

0 votes
1 answer

Is it possible to run a java program from command line on windows?How?

  Let's say your file is in C:\myprogram\ Run ...READ MORE

answered Apr 18, 2018 in Java by sophia
• 1,400 points
654 views
0 votes
1 answer

How to include jars in classpath using command line?

I have tried the following and it's ...READ MORE

answered Jan 3, 2019 in Java by Daisy
• 8,090 points
764 views
+5 votes
3 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,420 points

edited Nov 6, 2018 by Omkar 24,688 views
0 votes
1 answer

How to take input from users?

Scanner Class is used to take input ...READ MORE

answered Apr 17, 2018 in Java by Akrati
• 3,150 points
70 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,060 views
0 votes
0 answers
0 votes
1 answer

What is the equivalent to a JavaScript setInterval/setTimeout in Android/Java?

Hii @kartik, As always with Android there's lots ...READ MORE

answered May 26 in Java by Niroj
• 33,440 points
67 views
0 votes
1 answer

How to run a .java file from command line passing arguments in Maven?

Hello @kartik, You could run: mvn exec:exec -Dexec.args="arg1". This will ...READ MORE

answered Jun 3 in Java by Niroj
• 33,440 points
166 views
0 votes
1 answer

How to run a Java program from the command line on Windows?

Hello @kartik, In case your Java class is ...READ MORE

answered Apr 9 in Java by Niroj
• 33,440 points
80 views