Making a Project Available - novoda/public-mvn-repo GitHub Wiki

Making releases available to others

The following steps will help you in publishing a new relase of a project onto this repo.

NOTE You will only need to do steps 1 and 2 once for your machine, 3 and 4 once for each project setup.

1: Clone this repo

2: Add this to your settings file in .m2/settings.xml, changing the <local.public.mvn.repo> to point to where you cloned this repo on your system

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                  http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <profiles>
    <profile>
      <id>localrelease</id>
        <properties>
		  <local.public.mvn.repo>file:/Users/Peter/github/public-mvn-repo/releases</local.public.mvn.repo>
		</properties>
	</profile>
  </profiles>

  <activeProfiles>
	<activeProfile>localrelease</activeProfile>
  </activeProfiles>
</settings>

3: Add the following to the parent pom.xml of your project BUT change the github project url:

<scm>
    <url>http://github.com/novoda/Commons/tree/${scm.branch}</url>
    <connection>scm:git:git://github.com/novoda/Commons.git</connection>
    <developerConnection>scm:git:ssh://[email protected]/novoda/Commons.git</developerConnection>
  </scm>

<distributionManagement>
    <repository>
      <id>local-public-mvn-repo</id>
      <name>local clone of https://github.com/novoda/public-mvn-repo</name>
      <url>${local.public.mvn.repo}</url>
    </repository>
</distributionManagement>

<build>
    <plugins>
      <plugin>
        <artifactId>maven-scm-plugin</artifactId>
        <configuration>
          <scmVersionType>branch</scmVersionType>
          <scmVersion>${scm.branch}</scmVersion>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <useReleaseProfile>false</useReleaseProfile>
        </configuration>
        <goals />
      </plugin>
    </plugins>
</build>

4: Ensure all modules in your project have their version on SNAPSHOT

5: Run this command from the root of your project BUT ensure everything is commited and pushed upstream from your local repo:

mvn release:prepare release:perform -Plocalrelease

(This will run the tests in your prject, increment the version and publish a jar in your local public-mvn-repo repo)

6: Commit and push the changes in public-mvn-repo on your machine

⚠️ **GitHub.com Fallback** ⚠️