Project

General

Profile

Actions

MavenFaq » History » Revision 7

« Previous | Revision 7/44 (diff) | Next »
Andreas Kohlbecker, 04/15/2011 10:31 AM


Maven FAQ

Tips and hits for using maven. For other FAQ please check GeneralDev & DeveloperFaq

Adding a bundle to a maven repository

Local

In order to install a file (e.g. a JAR) in you local repositry:

mvn install:install-file \
      -DgroupId=<group-id> \
      -DartifactId=<artifact-id> \
      -Dversion=<version> \
      -Dfile=<path-to-file> \
      -Dpackaging=<packaging> (i.e. jar) \
      -DgeneratePom=true

e.g. To install aspectjrt version 1.6.2 in your local repositry:

mvn install:install-file  -DgroupId=aspectj -DartifactId=aspectjrt -Dversion=1.6.2 -Dfile=aspectjrt.jar -Dpackaging=jar -DgeneratePom=true

Remote

In order to deploy a jar to a remote repository deploy:deploy-file should be used, since this plugin will also create the *.sha files with a hash.

Example: Prepare aspectjrt version 1.6.2 for a remote repository. With this command you in fact create the artifact in local temporary repository and then copy the resulting files to the remote repository:

mvn deploy:deploy-file -DgroupId=aspectj -DartifactId=aspectjrt -Dversion=1.6.2 -Dpackaging=jar -Dfile=aspectjrt.jar -Durl=file:///D:/tmp/repo

It is also possible to directy deploy to the remote repository via scp:

mvn deploy:deploy-file -DgroupId=aspectj -DartifactId=aspectjrt -Dversion=1.6.2 -Dpackaging=jar -Dfile=aspectjrt.jar -Durl=scp://you@192.168.1.17/var/www/wp5.e-taxonomy.eu/cdmlib/mavenrepo/org/aspectj/aspectjrt -DgeneratePom=true

Of course the repository must be configured in the ~/.m2/settings.xml file. The repository is accessed with SCP, authentication is done with public/private key. I could not jet get to work the delpoying via scp, though (Andreas K).

eg:

<servers>
    <server>
      <id>wp5.e-taxonomy.eu</id>
      <username>you</username>
        <passphrase>XXXXXXXXXXXX</passphrase>
      <filePermissions>775</filePermissions>
      <directoryPermissions>775</directoryPermissions>
      <privateKey>/Users/you/.ssh/id_rsa</privateKey>
    </server>
</servers>

Also see: How do I install a file in my local repository along with a generic POM

Creating maven artifacts from eclipse bundles

The taxeditor poms require access to the latest eclipse bundles as maven artifacts. Luckily the maven-eclipse-plugin has a feature for that.

Please make sure that you have the deltapack installed before doing this.

$ mvn eclipse:to-maven -DeclipseDir=<path to your eclipse installation or target platform>/eclipse \
                    -DdeployTo=<repository server id as in settings.xml>::default::<your maven repository as configured in parent pom.xml> \
                    -DstripQualifier=true

If you do not want to deploy to the maven repository skip the deployTo option.

For further information please refer to http://maven.apache.org/plugins/maven-eclipse-plugin/to-maven-mojo.html

Please note that this is a rather lengthy operation.

Using the maven release plugin

Test run release:prepare while editing the pom.xml files:

mvn -DdryRun=true -Dmaven.test.skip=true --batch-mode -DcheckModificationExcludeList=pom.xml release:prepare

prepare a release (non interactive)

mvn --batch-mode release:prepare

Updated by Andreas Kohlbecker about 13 years ago · 7 revisions