Author: snicoll Date: Sun Sep 25 01:32:41 2005 New Revision: 291392 URL: http://svn.apache.org/viewcvs?rev=291392&view=rev Log: * Moved maven-rar-plugin from the sandbox to maven-plugins * MNG-854: Added javadoc and web site doco
Added: maven/components/trunk/maven-plugins/maven-rar-plugin/ - copied from r291386, maven/components/trunk/sandbox/maven-rar-plugin/ maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/ maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/apt/ maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/apt/howto.apt maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/apt/introduction.apt maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/site.xml Modified: maven/components/trunk/maven-plugins/maven-rar-plugin/pom.xml maven/components/trunk/maven-plugins/maven-rar-plugin/src/main/java/org/apache/maven/plugin/rar/RarMojo.java maven/components/trunk/maven-plugins/pom.xml Modified: maven/components/trunk/maven-plugins/maven-rar-plugin/pom.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-rar-plugin/pom.xml?rev=291392&r1=291386&r2=291392&view=diff ============================================================================== --- maven/components/trunk/maven-plugins/maven-rar-plugin/pom.xml (original) +++ maven/components/trunk/maven-plugins/maven-rar-plugin/pom.xml Sun Sep 25 01:32:41 2005 @@ -8,7 +8,7 @@ <artifactId>maven-rar-plugin</artifactId> <packaging>maven-plugin</packaging> <name>Maven Rar plugin</name> - <version>2.0-beta-1-SNAPSHOT</version> + <version>2.0-beta-2-SNAPSHOT</version> <dependencies> <dependency> <groupId>org.apache.maven</groupId> @@ -17,8 +17,7 @@ </dependency> <dependency> <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> - <version>2.0-beta-1</version> + <artifactId>maven-project</artifactId> </dependency> </dependencies> </model> Modified: maven/components/trunk/maven-plugins/maven-rar-plugin/src/main/java/org/apache/maven/plugin/rar/RarMojo.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-rar-plugin/src/main/java/org/apache/maven/plugin/rar/RarMojo.java?rev=291392&r1=291386&r2=291392&view=diff ============================================================================== --- maven/components/trunk/maven-plugins/maven-rar-plugin/src/main/java/org/apache/maven/plugin/rar/RarMojo.java (original) +++ maven/components/trunk/maven-plugins/maven-rar-plugin/src/main/java/org/apache/maven/plugin/rar/RarMojo.java Sun Sep 25 01:32:41 2005 @@ -58,7 +58,7 @@ * * @parameter expression="${basedir}/src/rar/META-INF/ra.xml" */ - private String raXmlLocation; + private String raXmlFile; /** * Specify if the generated jar file of this project should be @@ -72,9 +72,8 @@ * The location of the manifest file to be used within the rar file. * * @parameter expression="${basedir}/src/rar/META-INF/MANIFEST.MF" - * @TODO handle this field */ - private String manifestLocation; + private String manifestFile; /** * Directory that resources are copied to during the build. @@ -127,8 +126,8 @@ { getLog().debug( " ======= RarMojo settings =======" ); getLog().debug( "rarSourceDirectory[" + rarSourceDirectory + "]" ); - getLog().debug( "manifestLocation[" + manifestLocation + "]" ); - getLog().debug( "raXmlLocation[" + raXmlLocation + "]" ); + getLog().debug( "manifestFile[" + manifestFile + "]" ); + getLog().debug( "raXmlFile[" + raXmlFile + "]" ); getLog().debug( "workDirectory[" + workDirectory + "]" ); getLog().debug( "outputDirectory[" + outputDirectory + "]" ); getLog().debug( "finalName[" + finalName + "]" ); @@ -185,6 +184,16 @@ throw new MojoExecutionException( "Error copying RAR resources", e ); } + // Include custom manifest if necessary + try + { + includeCustomRaXmlFile(); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error copying ra.xml file", e ); + } + // Check if connector deployment descriptor is there File ddFile = new File( getBuildDir(), RA_XML_URI ); if ( !ddFile.exists() ) @@ -199,6 +208,9 @@ MavenArchiver archiver = new MavenArchiver(); archiver.setOutputFile( rarFile ); + // Include custom manifest if necessary + includeCustomManifestFile(); + archiver.getArchiver().addDirectory( getBuildDir() ); archiver.createArchive( project, archive ); } @@ -206,8 +218,6 @@ { throw new MojoExecutionException( "Error assembling RAR", e ); } - - } protected File getBuildDir() @@ -217,5 +227,33 @@ buildDir = new File( workDirectory ); } return buildDir; + } + + private void includeCustomManifestFile() + { + File customManifestFile = new File( manifestFile ); + if ( !customManifestFile.exists() ) + { + getLog().info( "Could not find manifest file: " + manifestFile +" - Generating one"); + } + else + { + getLog().info( "Including custom manifest file[" + customManifestFile + "]" ); + archive.setManifestFile( customManifestFile ); + } + } + + private void includeCustomRaXmlFile() + throws IOException + { + if (raXmlFile == null || raXmlFile.trim().length() == 0) { + + } + File raXml = new File(raXmlFile ); + if (raXml.exists()) { + getLog().info( "Using ra.xml "+ raXmlFile); + File metaInfDir = new File(getBuildDir(), "META-INF"); + FileUtils.copyFileToDirectory( raXml, metaInfDir); + } } } Added: maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/apt/howto.apt URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/apt/howto.apt?rev=291392&view=auto ============================================================================== --- maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/apt/howto.apt (added) +++ maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/apt/howto.apt Sun Sep 25 01:32:41 2005 @@ -0,0 +1,53 @@ + ------ + Maven 2 Rar Plugin: configuration examples + ------ + Stephane Nicoll + <[EMAIL PROTECTED]> + ------ + September 25, 2005 + +Introduction + + The RAR plugin allows to package resource adapter archive. Invoking this plugin + will actually compile and generate an archive for the connector's compiled + classes. + + By default, the generated JAR file is included in the RAR file. This behavior + is controlled by the <includeJar> property. For instance, to exclude the generated + JAR file from the RAR, configure your project as follows: + ++-------- + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-rar-plugin</artifactId> + <configuration> + <includeJar>false</includeJar> + </configuration> + </plugin> + </plugins> + </build> ++--------- + + + It is also possible to specify a custom location for the ra.xml file. For + instance to use the file located in src/resources/ra.xml, configure your + project as follows: + ++-------- + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-rar-plugin</artifactId> + <configuration> + <raXmlFile>src/resources/ra.xml</raXmlFile> + </configuration> + </plugin> + </plugins> + </build> ++--------- + + + Added: maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/apt/introduction.apt URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/apt/introduction.apt?rev=291392&view=auto ============================================================================== --- maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/apt/introduction.apt (added) +++ maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/apt/introduction.apt Sun Sep 25 01:32:41 2005 @@ -0,0 +1,16 @@ + ------ + Maven 2 Rar Plugin + ------ + Stephane Nicoll + <[EMAIL PROTECTED]> + ------ + September 25, 2005 + +Introduction + + This plugin generates Resource adapter archive (RAR) file. + + The full description of goals is available {{{index.html}here}}. + + + Added: maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/site.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/site.xml?rev=291392&view=auto ============================================================================== --- maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/site.xml (added) +++ maven/components/trunk/maven-plugins/maven-rar-plugin/src/site/site.xml Sun Sep 25 01:32:41 2005 @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<!-- +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> + +<project name="Maven Rar Plugin"> + <bannerLeft> + <name>Maven Rar Plugin</name> + <src>http://maven.apache.org/images/apache-maven-project.png</src> + <href>http://maven.apache.org/</href> + </bannerLeft> + <bannerRight> + <src>http://maven.apache.org/images/maven-small.gif</src> + </bannerRight> + <body> + <links> + <item name="Maven 2" href="http://maven.apache.org/maven2/"/> + </links> + + <menu name="Overview"> + <item name="Introduction" href="introduction.html"/> + <item name="How to Use" href="howto.html"/> + </menu> + ${reports} + </body> +</project> Modified: maven/components/trunk/maven-plugins/pom.xml URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/pom.xml?rev=291392&r1=291391&r2=291392&view=diff ============================================================================== --- maven/components/trunk/maven-plugins/pom.xml (original) +++ maven/components/trunk/maven-plugins/pom.xml Sun Sep 25 01:32:41 2005 @@ -166,6 +166,7 @@ <module>maven-pmd-plugin</module> <module>maven-projecthelp-plugin</module> <module>maven-project-info-reports-plugin</module> + <module>maven-rar-plugin</module> <module>maven-release-plugin</module> <module>maven-resources-plugin</module> <module>maven-site-plugin</module> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]