Maven Sandbox

From HaFrWiki
Jump to: navigation, search

What is a Sandbox?
The sandbox is used to "incubate" new plugins. Sandbox plugins will not be released to the repositories and if you are interrested in trying it out you will probably have to build it from source. All new code should be put in the sandbox so we can make sure that the plugin uses the correct code style, that is has proper documentation and generally has the expected quality.

How to build a not released plugin for Maven 2. The information on the internet is not always up-to-date, because of the many changes. So also the information presented here maybe outdated. The current information is made on July 31 2008.


Codehaus[edit]

The plugins on the Mojo Codehaus site are divided into:

  • Production plugins have been released and are generally available for production use.
  • Pre-released plugins have had releases, but are not deemed ready for production use yet.
  • Sandbox plugins ave been contributed but have not gained the attention of users or a committer interested in seeing it released.
  • Graveyard plugins have been deprecated,

Sandbox[edit]

When a (Mojo CodeHaus) plugin is a Sandbox plugin Subversion is needed to get the sources to build the plugin. Always check if the location of the subversion repository is correct. To check-out the code with subversion look at the Source Code under the Project Information of the required plugin. It looks like this (Simian plugin example):

 svn checkout https://svn.codehaus.org/mojo/trunk/sandbox/simian-report-maven-plugin simian-report-maven-plugin


Most plugins are available through the Snapshot repository. To access them use the following code in the pom.xml. Best way is to add this code to the pom.xml that is checkout from subversion.

   <repositories>
      <repository>
         <id>Codehaus Snapshots</id>
         <url>http://snapshots.repository.codehaus.org/</url>
         <snapshots>
            <enabled>true</enabled>
         </snapshots>
         <releases>
            <enabled>false</enabled>
         </releases>
      </repository>
   </repositories>

   <pluginRepositories>
      <pluginRepository>
         <id>Codehaus Snapshots</id>
         <url>http://snapshots.repository.codehaus.org/</url>
         <snapshots>
            <enabled>true</enabled>
         </snapshots>
         <releases>
            <enabled>false</enabled>
         </releases>
      </pluginRepository>
   </pluginRepositories>

or add a profile into the settings.xml (located in the maven  %M2%\Conf directory):

<profiles>
    <profile>
      <id>Snapshots</id>
      <repositories>
        <repository>
          <id>Codehaus Snapshots</id>
          <url>http://snapshots.repository.codehaus.org/</url>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <releases>
            <enabled>false</enabled>
          </releases>
       </repository>
     </repositories>
     <pluginRepositories>
       <pluginRepository>
         <id>Codehaus Snapshots</id>
         <url>http://snapshots.repository.codehaus.org/</url>
         <snapshots>
           <enabled>true</enabled>
         </snapshots>
         <releases>
           <enabled>false</enabled>
         </releases>
       </pluginRepository>
     </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>Snapshots</activeProfile>
  </activeProfiles>

Build Sandbox[edit]

At this point the following items should be available:

  • Code checkout of the source code with subversion
  • Creation of the snapshot repository in either the pom.xml or the settings.xml

Now goto the source directory of the plugin (where the pom.xml is). And execute the command

 mvn install

The result (after some time will be:

[INFO] [jar:jar]
[INFO] Building jar: Z:\MavenSrc\simian-report-maven-plugin\target\simian-report-maven-plugin-1.0-SNAPSHOT.jar
[INFO] [plugin:addPluginArtifactMetadata]
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.pom
1K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-components/1.1.7/plexus-components-1.1.7.pom
4K downloaded
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-digest/1.0/plexus-digest-1.0.jar
11K downloaded
[INFO] [install:install]
[INFO] Installing Z:\MavenSrc\simian-report-maven-plugin\target\simian-report-maven-plugin-1.0-SNAPSHOT.jar to 
                C:\Documents and Settings\Administrator\.m2\repository\org\codehaus\mojo\simian-report-maven-plugin\1.0-SNAPSHOT\
                simian-report-maven-plugin-1.0-SNAPSHOT.jar
[INFO] [plugin:updateRegistry]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------

The build and installation of the plugin has been successful.

See also[edit]