'How to install a tagged version (i.e. not a snapshot) of your project locally and not to the maven central?

So I have done mvn release:clean and mvn release:prepare.

As a result I have a clean tag on my subversion with the latest version 1.3.3 of my artifact.

Now I want to install that version 1.3.3 on my local maven repo (.m2) and NOT to the remote central maven repo.

How to do that?

Do I need to change something on my settings.xml ???

Do I need to run mvn release:perform with some kind of local options ??? Right now if I run mvn release:perform it will try to release my artifact to the maven central repo, which is exactly what I do not want. I want to release it locally to my other local projects, so I can do:

<dependency>
  <groupId>com.mycompany</groupId>
  <artifactId>myartifact</artifactId>
  <version>1.3.3</version>
</dependency>

Interestingly enough, snapshots work fine:

<dependency>
      <groupId>com.mycompany</groupId>
      <artifactId>myartifact</artifactId>
      <version>1.3.4-SNAPSHOT</version>
    </dependency>

So I am installing snapshots, but not full releases.

Here is my settings.xml:

<settings>

  <profiles>

  <profile>
     <id>allow-snapshots</id>
        <activation><activeByDefault>true</activeByDefault></activation>
     <repositories>
       <repository>
         <id>snapshots-repo</id>
         <url>https://oss.sonatype.org/content/repositories/snapshots</url>
         <releases><enabled>false</enabled></releases>
         <snapshots><enabled>true</enabled></snapshots>
       </repository>
     </repositories>
   </profile>

    <profile>
      <id>mac-profile</id>
      <properties>

        <project.build.sourceEncoding>
          UTF-8
        </project.build.sourceEncoding>

        <project.reporting.outputEncoding>
          UTF-8
        </project.reporting.outputEncoding>

      </properties>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>mac-profile</activeProfile>
  </activeProfiles>

  <pluginGroups>
    <pluginGroup>org.sonatype.plugins</pluginGroup>
  </pluginGroups>
  <servers>
    <server>
      <id>sonatype-nexus-snapshots</id>
      <username>myUsername</username>
      <password>myPassword</password>
    </server>
    <server>
      <id>sonatype-nexus-staging</id>
      <username>myUsername</username>
      <password>myPassword</password>
    </server>
  </servers>
</settings>


Solution 1:[1]

The simplest thing to do is to checkout the tag in another directory and then run

mvn install

However, if you want to use release:perform, you need to change the goals.

http://maven.apache.org/maven-release/maven-release-plugin/perform-mojo.html#goals is the parameter, make it say install instead of deploy.

Solution 2:[2]

All you have to do is:

mvn clean install 

Solution 3:[3]

I had a similar situation where I needed release jars to be installed into the local repository while doing mvn release:clean release:prepare. The following worked for me:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.3</version>
        <configuration>
            <!-- this should do the trick -->
            <preparationGoals>install</preparationGoals>
        </configuration>
    </plugin>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bmargulies
Solution 2 boaglio
Solution 3 armandino