0

So I'm trying to wrap my head around Maven. After installing it I now want to install JodaTime because it's a dependency for another project.

I know I can download it and do a mvn clean install from within the JodaTime dir. From my experience with other package managers such as apt I suspect there is also a way of installing new software without manually downloading and untarring though. I just tried mvn install JodaTime, but I get an error saying:

Unknown lifecycle phase "JodaTime". You must specify a valid lifecycle phase [etc. etc.]

So my question; is there a way to install software in Maven without manually downloading it?

kramer65
  • 50,427
  • 120
  • 308
  • 488

3 Answers3

2

If your project needs joda-time artifact as a dependency, you don't need to install it, all you need is to specify a dependency:

<dependencies>
  <dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>2.3</version>
  </dependency>
</dependencies>

If you're trying to build joda-time yourself from source in case you wanted to modify the source of joda-time then you need to check out the source from https://github.com/JodaOrg/joda-time and run mvn install to install it to your local repository.

Zilvinas
  • 5,518
  • 3
  • 26
  • 26
0

Maven is not build to do that (like sudo apt install in linux). But the closest is this as far as I know

dependency:get mvn dependency:get -DrepoUrl=http://repo1.maven.org/maven2/ \ -DgroupId=junit -DartifactId=junit -Dversion=4.8.2 \

Check this also

Community
  • 1
  • 1
aksappy
  • 3,400
  • 3
  • 23
  • 49
0

Usually it is enough to just define a dependency in your pom.xml and MAven will do the right thing:

<dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>1.6</version>
   </dependency>

In some cases you might need to define additional repositories in your settings.xml, but usually that is all you have to do.

Gyro Gearless
  • 5,131
  • 3
  • 18
  • 14