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, 2020 in Java by kartik
• 37,510 points
2,470 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, 2020 by Niroj
• 82,880 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
2,375 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,120 points
8,457 views
+5 votes
4 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,450 points

edited Nov 7, 2018 by Omkar 79,515 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,190 points
575 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,060 views
0 votes
1 answer
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, 2020 in Java by Niroj
• 82,880 points
3,193 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, 2020 in Java by Niroj
• 82,880 points
19,924 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, 2020 in Java by Niroj
• 82,880 points
682 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP