You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by jo...@apache.org on 2006/10/27 22:33:39 UTC
svn commit: r468524 - in /webservices/axis2/branches/java/1_1: ./
modules/parent/ modules/tool/ modules/tool/axis2-aar-maven-plugin/
modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/
modules/tool/axis2-aar-maven-plugin/src/...
Author: jochen
Date: Fri Oct 27 13:33:38 2006
New Revision: 468524
URL: http://svn.apache.org/viewvc?view=rev&rev=468524
Log:
Work on the docs for the axís2-aar-maven-plugin.
Added:
webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/apt/configuration.apt
Modified:
webservices/axis2/branches/java/1_1/modules/parent/pom.xml
webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/pom.xml
webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/AarMojo.java
webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/AbstractAarMojo.java
webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/FileSet.java
webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/apt/howto.apt
webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/site.xml
webservices/axis2/branches/java/1_1/modules/tool/pom.xml
webservices/axis2/branches/java/1_1/pom.xml
Modified: webservices/axis2/branches/java/1_1/modules/parent/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/parent/pom.xml?view=diff&rev=468524&r1=468523&r2=468524
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/parent/pom.xml (original)
+++ webservices/axis2/branches/java/1_1/modules/parent/pom.xml Fri Oct 27 13:33:38 2006
@@ -19,6 +19,11 @@
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>3</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-parent</artifactId>
@@ -66,9 +71,9 @@
</issueManagement>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/webservices/axis2/trunk/java</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/webservices/axis2/trunk/java</developerConnection>
- <url>http://svn.apache.org/viewvc/webservices/axis2/trunk/java</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/webservices/axis2/branches/java/1_1</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/webservices/axis2/branches/java/1_1</developerConnection>
+ <url>http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1</url>
</scm>
<mailingLists>
Modified: webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/pom.xml?view=diff&rev=468524&r1=468523&r2=468524
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/pom.xml (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/pom.xml Fri Oct 27 13:33:38 2006
@@ -22,12 +22,14 @@
<parent>
<groupId>org.apache.axis2.maven2</groupId>
<artifactId>axis2-maven-tools</artifactId>
- <version>1.1-SNAPSHOT</version>
+ <version>1.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>axis2-aar-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>Axis 2 Aar Maven Plugin</name>
+
<description>
A Maven 2 plugin for creating Axis 2 service archives (aar files)
</description>
@@ -54,4 +56,39 @@
<artifactId>maven-artifact</artifactId>
</dependency>
</dependencies>
+
+ <developers>
+ <developer>
+ <id>jochen</id>
+ <name>Jochen Wiedmann</name>
+ <email>jochen.wiedmann@gmail.com</email>
+ </developer>
+ </developers>
+
+ <contributors>
+ <contributor>
+ <name>John Pfeifer</name>
+ <email>john.pfeifer@hnpsolutions.com</email>
+ </contributor>
+ </contributors>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin</artifactId>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>changes-report</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
Modified: webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/AarMojo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/AarMojo.java?view=diff&rev=468524&r1=468523&r2=468524
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/AarMojo.java (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/AarMojo.java Fri Oct 27 13:33:38 2006
@@ -38,7 +38,6 @@
*/
public class AarMojo extends AbstractAarMojo
{
-
/**
* The directory for the generated aar.
*
Modified: webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/AbstractAarMojo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/AbstractAarMojo.java?view=diff&rev=468524&r1=468523&r2=468524
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/AbstractAarMojo.java (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/AbstractAarMojo.java Fri Oct 27 13:33:38 2006
@@ -18,7 +18,13 @@
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
@@ -115,6 +121,7 @@
try
{
final File metaInfDir = new File( aarDirectory, "META-INF" );
+ final File libDir = new File(aarDirectory, "lib");
final File servicesFileTarget = new File( metaInfDir, "services.xml" );
boolean existsBeforeCopyingClasses = servicesFileTarget.exists();
@@ -146,13 +153,107 @@
copyMetaInfFile( servicesXmlFile, servicesFileTarget, existsBeforeCopyingClasses, "services.xml file" );
copyMetaInfFile( wsdlFile, wsdlFileTarget, wsdlExistsBeforeCopyingClasses, "WSDL file" );
- }
+
+ Set artifacts = project.getArtifacts();
+
+ List duplicates = findDuplicates( artifacts );
+
+ for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
+ {
+ Artifact artifact = (Artifact) iter.next();
+ String targetFileName = getDefaultFinalName( artifact );
+
+ getLog().debug( "Processing: " + targetFileName );
+
+ if ( duplicates.contains( targetFileName ) )
+ {
+ getLog().debug( "Duplicate found: " + targetFileName );
+ targetFileName = artifact.getGroupId() + "-" + targetFileName;
+ getLog().debug( "Renamed to: " + targetFileName );
+ }
+
+ // TODO: utilise appropriate methods from project builder
+ ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
+ if ( !artifact.isOptional() && filter.include( artifact ) )
+ {
+ String type = artifact.getType();
+ if ( "jar".equals( type ) )
+ {
+ copyFileIfModified( artifact.getFile(), new File( libDir, targetFileName ) );
+ }
+ }
+ }
+ }
catch ( IOException e )
{
throw new MojoExecutionException( "Could not explode aar...", e );
}
}
+ /**
+ * Searches a set of artifacts for duplicate filenames and returns a list of duplicates.
+ *
+ * @param artifacts set of artifacts
+ * @return List of duplicated artifacts
+ */
+ private List findDuplicates( Set artifacts )
+ {
+ List duplicates = new ArrayList();
+ List identifiers = new ArrayList();
+ for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
+ {
+ Artifact artifact = (Artifact) iter.next();
+ String candidate = getDefaultFinalName( artifact );
+ if ( identifiers.contains( candidate ) )
+ {
+ duplicates.add( candidate );
+ }
+ else
+ {
+ identifiers.add( candidate );
+ }
+ }
+ return duplicates;
+ }
+
+ /**
+ * Converts the filename of an artifact to artifactId-version.type format.
+ *
+ * @param artifact
+ * @return converted filename of the artifact
+ */
+ private String getDefaultFinalName( Artifact artifact )
+ {
+ return artifact.getArtifactId() + "-" + artifact.getVersion() + "." +
+ artifact.getArtifactHandler().getExtension();
+ }
+
+ /**
+ * Copy file from source to destination only if source timestamp is later than the destination timestamp.
+ * The directories up to <code>destination</code> will be created if they don't already exist.
+ * <code>destination</code> will be overwritten if it already exists.
+ *
+ * @param source An existing non-directory <code>File</code> to copy bytes from.
+ * @param destination A non-directory <code>File</code> to write bytes to (possibly
+ * overwriting).
+ * @throws IOException if <code>source</code> does not exist, <code>destination</code> cannot be
+ * written to, or an IO error occurs during copying.
+ * @throws java.io.FileNotFoundException if <code>destination</code> is a directory
+ * <p/>
+ * TO DO: Remove this method when Maven moves to plexus-utils version 1.4
+ */
+ private void copyFileIfModified( File source, File destination )
+ throws IOException
+ {
+ // TO DO: Remove this method and use the method in WarFileUtils when Maven 2 changes
+ // to plexus-utils 1.2.
+ if ( destination.lastModified() < source.lastModified() )
+ {
+ FileUtils.copyFile( source.getCanonicalFile(), destination );
+ // preserve timestamp
+ destination.setLastModified( source.lastModified() );
+ }
+ }
private void copyFileSet( FileSet fileSet, File targetDirectory )
throws IOException
@@ -174,7 +275,7 @@
DirectoryScanner ds = new DirectoryScanner();
ds.setBasedir( dir );
- if ( !fileSet.isSuppressDefaultExcludes() )
+ if ( !fileSet.isSkipDefaultExcludes() )
{
ds.addDefaultExcludes();
}
Modified: webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/FileSet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/FileSet.java?view=diff&rev=468524&r1=468523&r2=468524
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/FileSet.java (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/main/java/org/apache/axis2/maven2/aar/FileSet.java Fri Oct 27 13:33:38 2006
@@ -30,7 +30,7 @@
private File directory;
private String outputDirectory;
private String[] includes, excludes;
- private boolean suppressDefaultExcludes;
+ private boolean skipDefaultExcludes;
/**
* Returns the file sets base directory. May be omitted, in which
@@ -104,17 +104,17 @@
* Returns, whether the default excludes should be used. Defaults
* to true.
*/
- public boolean isSuppressDefaultExcludes()
+ public boolean isSkipDefaultExcludes()
{
- return suppressDefaultExcludes;
+ return skipDefaultExcludes;
}
/**
* Sets, whether the default excludes should be used. Defaults to
* true.
*/
- public void setSuppressDefaultExcludes( boolean suppressDefaultExcludes )
+ public void setSkipDefaultExcludes( boolean skipDefaultExcludes )
{
- this.suppressDefaultExcludes = suppressDefaultExcludes;
+ this.skipDefaultExcludes = skipDefaultExcludes;
}
}
Added: webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/apt/configuration.apt
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/apt/configuration.apt?view=auto&rev=468524
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/apt/configuration.apt (added)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/apt/configuration.apt Fri Oct 27 13:33:38 2006
@@ -0,0 +1,105 @@
+Configuration
+
+ All Aar plugin goals takes the following configuration parameters as input:
+
+*------------------+----------------------------------+------------------------------------------------+
+| Parameter name | Default value | Description |
+*------------------+----------------------------------+------------------------------------------------+
+| aarDirectory | ${project.build.directory}/aar | Directory where the aar file is built. |
+*------------------+----------------------------------+------------------------------------------------+
+| classesDirectory | ${project.build.outputDirectory} | Directory with compiled classes and resources. |
+*------------------+----------------------------------+------------------------------------------------+
+| fileSets | | Additional file sets, which are being added to |
+| | | the archive. See "File Sets" below for an |
+| | | example. |
+*------------------+----------------------------------+------------------------------------------------+
+| servicesXmlFile | | Location of the services.xml file. By default, |
+| | | it is assumed that the file is already present |
+| | | in classesDirectory/META-INF and no special |
+| | | processing is required. |
+*------------------+----------------------------------+------------------------------------------------+
+| wsdlFile | | Location of the WSDL file. By default, it is |
+| | | assumed that the file is already present in |
+| | | classesDirectory/META-INF and no special |
+| | | processing is required. |
+*------------------+----------------------------------+------------------------------------------------+
+| wsdlFileName | service.wsdl | Name, to which the WSDL file should be mapped. |
+*------------------+----------------------------------+------------------------------------------------+
+
+
+The aar goal
+
+ The aar goal allows the following additional parameters:
+
+*------------------+----------------------------+------------------------------------------------+
+| Parameter name | Default value | Description |
+*------------------+----------------------------+------------------------------------------------+
+| outputDirectory | ${project.build.directory} | Directory where to generate the AAR file. |
+*------------------+----------------------------+------------------------------------------------+
+| aarName | ${project.build.finalName} | The generated AAR files name. |
+*------------------+----------------------------+------------------------------------------------+
+| archive | | A Maven archive configuration. This allows, |
+| | | for example, to configure the MANIFEST.MF |
+| | | file. |
+*------------------+----------------------------+------------------------------------------------+
+| classifier | | A classifier, which should be added to the |
+| | | generated AAR files name. Setting this |
+| | | parameter has the side effect, that the |
+| | | artifact is treated as an attachment and not |
+| | | as the projects primary artifact. |
+*------------------+----------------------------+------------------------------------------------+
+| primaryArtifact | true | Setting this property to false disables |
+| | | installation or deployment of the artifact as |
+| | | the projects primary artifact. |
+*------------------+----------------------------+------------------------------------------------+
+
+
+File Sets
+
+ Additional file sets may be configured for inclusion into the AAR file. A file set looks
+ as follows:
+
+-----------------
+ <fileSets>
+ <fileSet>
+ <directory>src/aar/files</directory>
+ <outputDirectory>META-INF/docs</outputDirectory>
+ <includes>
+ <include>**/*.html</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/aar/files</directory>
+ <outputDirectory>META-INF/etc</outputDirectory>
+ <excludes>
+ <exclude>**/*.html</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+-----------------
+
+ The example specifies, that the contents of the directory src/aar/files shall
+ be added to the AAR file. HTML files will go into META-INF/docs, all other
+ files to META-INF/etc.
+
+ A file set is configured through the following configuration parameters:
+
+*---------------------+-------------------------------------------------------------------+
+| Parameter name | Description |
+*---------------------+-------------------------------------------------------------------+
+| directory | The directory, from which to read the file set. This parameter is |
+| | required. |
+*---------------------+-------------------------------------------------------------------+
+| outputDirectory | The target directory within the AAR file. Defaults to the AAR |
+| | files root directory. |
+*---------------------+-------------------------------------------------------------------+
+| includes | Configures the set of files, which shall be included into the AAR |
+| | file. Defaults to **/*. |
+*---------------------+-------------------------------------------------------------------+
+| excludes | Configures a set of files, which shall be excluded from the file |
+| | set. Defaults to the Maven default excludes (**/*~, **/cvs/**/*, |
+| | **/.svn/**/*, etc.) |
+*---------------------+-------------------------------------------------------------------+
+| skipDefaultExcludes | If this parameter is set to true, then no default excludes are |
+| | being used. |
+*---------------------+-------------------------------------------------------------------+
Modified: webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/apt/howto.apt
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/apt/howto.apt?view=diff&rev=468524&r1=468523&r2=468524
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/apt/howto.apt (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/apt/howto.apt Fri Oct 27 13:33:38 2006
@@ -16,7 +16,7 @@
* exploded : package an exploded aar application
Each mode is materialized by a goal. For instance, to generate an exploded
- sar from the current project, one would type
+ aar from the current project, one would type
+--------
mvn aar:exploded
Modified: webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/site.xml?view=diff&rev=468524&r1=468523&r2=468524
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/site.xml (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-aar-maven-plugin/src/site/site.xml Fri Oct 27 13:33:38 2006
@@ -30,11 +30,13 @@
<body>
<links>
<item name="Maven 2" href="http://maven.apache.org/maven2/"/>
+ <item name="Axis 2" href="http://ws.apache.org/axis2/"/>
</links>
<menu name="Overview">
<item name="Introduction" href="introduction.html"/>
- <item name="How to Use" href="howto.html"/>
+ <item name="How to Use" href="howto.html"/>
+ <item name="Configuration" href="configuration.html"/>
</menu>
${reports}
</body>
Modified: webservices/axis2/branches/java/1_1/modules/tool/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/pom.xml?view=diff&rev=468524&r1=468523&r2=468524
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/pom.xml (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/pom.xml Fri Oct 27 13:33:38 2006
@@ -33,11 +33,19 @@
This is a set of Maven 2 plugins for working with Axis 2.
</description>
<packaging>pom</packaging>
+
+ <scm>
+ <connection>http://svn.apache.org/repos/asf/webservices/axis2/branches/java/1_1/modules/tool</connection>
+ <developerConnection>https://svn.apache.org/repos/asf/webservices/axis2/branches/java/1_1/modules/tool</developerConnection>
+ <url>http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool</url>
+ </scm>
+
<modules>
<module>axis2-aar-maven-plugin</module>
<module>axis2-java2wsdl-maven-plugin</module>
<module>axis2-wsdl2code-maven-plugin</module>
</modules>
+
<dependencyManagement>
<dependencies>
<dependency>
Modified: webservices/axis2/branches/java/1_1/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/pom.xml?view=diff&rev=468524&r1=468523&r2=468524
==============================================================================
--- webservices/axis2/branches/java/1_1/pom.xml (original)
+++ webservices/axis2/branches/java/1_1/pom.xml Fri Oct 27 13:33:38 2006
@@ -19,6 +19,11 @@
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>3</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org