Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update maven in ubuntu using command

Tags:

maven

ubuntu

I am using Ubuntu 11.10 and I have Maven 3.0.3 installed. Now I want to update it to Maven 3.0.4 due some surefire plug-in issue. But I do not know how to do that from command line.

Does anyone having any idea?

like image 531
Android Killer Avatar asked Aug 29 '12 07:08

Android Killer


People also ask

Where is Maven installed on Ubuntu?

IN short, binaries will be in /usr/bin, or some other location on your path ( try 'echo $PATH' on the command line to see the possible locations ). Configuration is always in a subdirectory of /etc. And the "home" is typically in /usr/lib or /usr/share.


2 Answers

I have just done it.... I exchange Maven 3.0.3 for now Maven 3.2.1 I did this steps:

  1. Remove old maven version:

    > sudo apt-get remove maven
    > sudo apt-get update
    
  2. Installation new version: Now I have improved my knowledge about linux I prefer to install the software by hand ;)
    So... I followed the Apache Installation Instruction on http://maven.apache.org/download.cgi and then I have added this rows in the file .baschrc:

         export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.1
         export M2=$M2_HOME/bin
         export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"
         export PATH=$PATH:$M2
    

I hope would be useful for someone.

like image 175
carlitos081 Avatar answered Oct 05 '22 23:10

carlitos081


You can simply define the maven-surefire-plugin versions in pluginManagement section of your pom or better in a company pom.

<build>
  <pluginManagement>
    <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <version>2.12.3</version>
       </plugin>
       ...
    </plugin>
  </pluginManagmenet>
</build>

If you don't have already a company wide pom your build is not reproducible which means if you change your maven version your build will use different plugin version which is true for all plugins. Furthermore it's best practice to define the versions of plugins in a build. There is no need to update Maven itself. You can if you running into Maven issues but not for plugins.

like image 33
khmarbaise Avatar answered Oct 05 '22 22:10

khmarbaise