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/11/23 08:29:22 UTC
svn commit: r478500 - in /webservices/axis2/branches/java/1_1/modules/tool:
./ axis2-mar-maven-plugin/ axis2-mar-maven-plugin/src/
axis2-mar-maven-plugin/src/changes/ axis2-mar-maven-plugin/src/main/
axis2-mar-maven-plugin/src/main/java/ axis2-mar-mave...
Author: jochen
Date: Wed Nov 22 23:29:21 2006
New Revision: 478500
URL: http://svn.apache.org/viewvc?view=rev&rev=478500
Log:
Adding the axis2-mar-maven-plugin
Added:
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/ (with props)
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/pom.xml
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/changes/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/changes/changes.xml
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/AbstractMarMojo.java
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/FileSet.java
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarExplodedMojo.java
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarInPlaceMojo.java
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarMojo.java
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/resources/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/resources/META-INF/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/resources/META-INF/plexus/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/resources/META-INF/plexus/components.xml
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/configuration.apt
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/howto.apt
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/introduction.apt
webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/site.xml
Modified:
webservices/axis2/branches/java/1_1/modules/tool/axis2-wsdl2code-maven-plugin/src/test/java/org/apache/axis2/maven2/wsdl2code/WSDL2CodeMojoTest.java
webservices/axis2/branches/java/1_1/modules/tool/pom.xml
Propchange: webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Nov 22 23:29:21 2006
@@ -0,0 +1 @@
+target
Added: webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/pom.xml?view=auto&rev=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/pom.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/pom.xml Wed Nov 22 23:29:21 2006
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ !
+ ! Copyright 2006 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
+ 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.axis2.maven2</groupId>
+ <artifactId>axis2-maven-tools</artifactId>
+ <version>1.1.0.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>axis2-mar-maven-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Axis 2 Mar Maven Plugin</name>
+
+ <description>
+ A Maven 2 plugin for creating Axis 2 module archives (mar files)
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-plugin-testing-harness</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>
Added: webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/changes/changes.xml?view=auto&rev=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/changes/changes.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/changes/changes.xml Wed Nov 22 23:29:21 2006
@@ -0,0 +1,12 @@
+<document>
+ <properties>
+ <title>Changes in the Axis2 MAR plugin for Maven 2</title>
+ </properties>
+ <body>
+ <release version="1.1.1-SNAPSHOT" date="Not yet released">
+ <action dev="jochen" type="add">
+ Initial release.
+ </action>
+ </release>
+ </body>
+</document>
Added: webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/AbstractMarMojo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/AbstractMarMojo.java?view=auto&rev=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/AbstractMarMojo.java (added)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/AbstractMarMojo.java Wed Nov 22 23:29:21 2006
@@ -0,0 +1,295 @@
+package org.apache.axis2.maven2.mar;
+
+/*
+ * Copyright 2006 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.
+ */
+
+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;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.FileUtils;
+
+
+
+/**
+ * Abstract base class of all the mojos in the axis2-mar-maven-plugin.
+ */
+public abstract class AbstractMarMojo
+ extends AbstractMojo
+{
+
+ /**
+ * The projects base directory.
+ *
+ * @parameter expression="${project.basedir}"
+ * @required
+ * @readonly
+ */
+ protected File baseDir;
+
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ protected MavenProject project;
+
+ /**
+ * The directory containing generated classes.
+ *
+ * @parameter expression="${project.build.outputDirectory}"
+ * @required
+ */
+ private File classesDirectory;
+
+ /**
+ * The directory where the mar is built.
+ *
+ * @parameter expression="${project.build.directory}/mar"
+ * @required
+ */
+ protected File marDirectory;
+
+ /**
+ * The location of the module.xml file. If it is present in the META-INF
+ * directory in src/main/resources with that name then it will automatically be
+ * included. Otherwise this parameter must be set.
+ *
+ * @parameter
+ */
+ private File moduleXmlFile;
+
+ /**
+ * Additional file sets, which are being added to the archive.
+ *
+ * @parameter
+ */
+ private FileSet[] fileSets;
+
+ /**
+ * Builds the exploded mar file.
+ * @throws MojoExecutionException
+ */
+ protected void buildExplodedMar( )
+ throws MojoExecutionException
+ {
+ getLog().debug( "Exploding mar..." );
+
+ marDirectory.mkdirs();
+ getLog().debug( "Assembling mar " + project.getArtifactId() + " in " + marDirectory );
+
+ try
+ {
+ final File metaInfDir = new File( marDirectory, "META-INF" );
+ final File libDir = new File(marDirectory, "lib");
+ final File moduleFileTarget = new File( metaInfDir, "module.xml" );
+ boolean existsBeforeCopyingClasses = moduleFileTarget.exists();
+
+ if ( classesDirectory.exists() && ( !classesDirectory.equals( marDirectory ) ) )
+ {
+ FileUtils.copyDirectoryStructure( classesDirectory, marDirectory );
+ }
+
+ if ( fileSets != null )
+ {
+ for ( int i = 0; i < fileSets.length; i++ )
+ {
+ FileSet fileSet = fileSets[i];
+ copyFileSet( fileSet, marDirectory );
+ }
+ }
+
+ copyMetaInfFile( moduleXmlFile, moduleFileTarget, existsBeforeCopyingClasses, "module.xml 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 mar...", 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
+ {
+ File dir = fileSet.getDirectory();
+ if ( dir == null )
+ {
+ dir = baseDir;
+ }
+ File targetDir = targetDirectory;
+ if ( fileSet.getOutputDirectory() != null )
+ {
+ targetDir = new File( targetDir, fileSet.getOutputDirectory() );
+ }
+ if ( targetDir.equals( dir ) )
+ {
+ return;
+ }
+
+ DirectoryScanner ds = new DirectoryScanner();
+ ds.setBasedir( dir );
+ if ( !fileSet.isSkipDefaultExcludes() )
+ {
+ ds.addDefaultExcludes();
+ }
+ final String[] excludes = fileSet.getExcludes();
+ if ( excludes != null )
+ {
+ ds.setExcludes( excludes );
+ }
+ final String[] includes = fileSet.getIncludes();
+ if ( includes != null )
+ {
+ ds.setIncludes( includes );
+ }
+ ds.scan();
+ String[] files = ds.getIncludedFiles();
+ for ( int i = 0; i < files.length; i++ )
+ {
+ File sourceFile = new File( dir, files[i] );
+ File targetFile = new File( targetDir, files[i] );
+ FileUtils.copyFile( sourceFile, targetFile );
+ }
+ }
+
+
+ private void copyMetaInfFile( final File pSource, final File pTarget,
+ final boolean pExistsBeforeCopying,
+ final String pDescription )
+ throws MojoExecutionException, IOException
+ {
+ if ( pSource != null && pTarget != null )
+ {
+ if ( !pSource.exists() )
+ {
+ throw new MojoExecutionException( "The configured " + pDescription + " could not be found at "
+ + pSource );
+ }
+
+ if ( !pExistsBeforeCopying && pTarget.exists() )
+ {
+ getLog().warn( "The configured " + pDescription + " overwrites another file from the classpath." );
+ }
+
+ FileUtils.copyFile( pSource, pTarget );
+ }
+ }
+}
Added: webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/FileSet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/FileSet.java?view=auto&rev=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/FileSet.java (added)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/FileSet.java Wed Nov 22 23:29:21 2006
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2006 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.
+ */
+package org.apache.axis2.maven2.mar;
+
+import java.io.File;
+
+
+/**
+ * A FileSet defines additional files, which are being added to the
+ * Axis application archive. The objects structure follows the
+ * FileSet object from the maven-assembly-plugin, see the
+ * <a href="http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html">plugin documentation</a>
+ * for details.
+ */
+public class FileSet
+{
+ private File directory;
+ private String outputDirectory;
+ private String[] includes, excludes;
+ private boolean skipDefaultExcludes;
+
+ /**
+ * Returns the file sets base directory. May be omitted, in which
+ * case the projects base directory is assumed.
+ */
+ public File getDirectory()
+ {
+ return directory;
+ }
+
+ /**
+ * Sets the file sets base directory. May be omitted, in which
+ * case the projects base directory is assumed.
+ */
+ public void setDirectory( File directory )
+ {
+ this.directory = directory;
+ }
+
+ /**
+ * Returns the file sets exclusion list.
+ */
+ public String[] getExcludes()
+ {
+ return excludes;
+ }
+
+ /**
+ * Sets the file sets exclusion list.
+ */
+ public void setExcludes( String[] excludes )
+ {
+ this.excludes = excludes;
+ }
+
+ /**
+ * Returns the file sets inclusion list.
+ */
+ public String[] getIncludes()
+ {
+ return includes;
+ }
+
+ /**
+ * Sets the file sets inclusion list.
+ */
+ public void setIncludes( String[] includes )
+ {
+ this.includes = includes;
+ }
+
+ /**
+ * Sets a prefix, which the included files should have
+ * when being added to the Axis application archive.
+ */
+ public String getOutputDirectory()
+ {
+ return outputDirectory;
+ }
+
+ /**
+ * Returns a prefix, which the included files should have
+ * when being added to the Axis application archive.
+ */
+ public void setOutputDirectory( String outputDirectory )
+ {
+ this.outputDirectory = outputDirectory;
+ }
+
+ /**
+ * Returns, whether the default excludes should be used. Defaults
+ * to true.
+ */
+ public boolean isSkipDefaultExcludes()
+ {
+ return skipDefaultExcludes;
+ }
+
+ /**
+ * Sets, whether the default excludes should be used. Defaults to
+ * true.
+ */
+ public void setSkipDefaultExcludes( boolean skipDefaultExcludes )
+ {
+ this.skipDefaultExcludes = skipDefaultExcludes;
+ }
+}
Added: webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarExplodedMojo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarExplodedMojo.java?view=auto&rev=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarExplodedMojo.java (added)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarExplodedMojo.java Wed Nov 22 23:29:21 2006
@@ -0,0 +1,36 @@
+package org.apache.axis2.maven2.mar;
+
+/*
+ * Copyright 2006 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.
+ */
+
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Generate the exploded mar
+ *
+ * @goal exploded
+ * @phase package
+ * @requiresDependencyResolution runtime
+ */
+public class MarExplodedMojo
+ extends AbstractMarMojo
+{
+ public void execute()
+ throws MojoExecutionException
+ {
+ buildExplodedMar();
+ }
+}
Added: webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarInPlaceMojo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarInPlaceMojo.java?view=auto&rev=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarInPlaceMojo.java (added)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarInPlaceMojo.java Wed Nov 22 23:29:21 2006
@@ -0,0 +1,38 @@
+package org.apache.axis2.maven2.mar;
+
+/*
+ * Copyright 2006 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.
+ */
+
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Generates mar in the source directory
+ *
+ * @goal inplace
+ * @requiresDependencyResolution runtime
+ */
+public class MarInPlaceMojo
+ extends AbstractMarMojo
+{
+
+ public void execute()
+ throws MojoExecutionException
+ {
+
+ getLog().debug("Generating mar in source directory... " + marDirectory);
+ buildExplodedMar();
+ }
+}
Added: webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarMojo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarMojo.java?view=auto&rev=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarMojo.java (added)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarMojo.java Wed Nov 22 23:29:21 2006
@@ -0,0 +1,161 @@
+package org.apache.axis2.maven2.mar;
+
+/*
+ * Copyright 2006 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.
+ */
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.archiver.MavenArchiveConfiguration;
+import org.apache.maven.archiver.MavenArchiver;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProjectHelper;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+import org.codehaus.plexus.archiver.jar.ManifestException;
+
+/**
+ * Build a mar.
+ *
+ * @goal mar
+ * @phase package
+ * @requiresDependencyResolution runtime
+ */
+public class MarMojo extends AbstractMarMojo
+{
+ /**
+ * The directory for the generated mar.
+ *
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ private String outputDirectory;
+
+ /**
+ * The name of the generated mar.
+ *
+ * @parameter expression="${project.build.finalName}"
+ * @required
+ */
+ private String marName;
+
+ /**
+ * The Jar archiver.
+ *
+ * @parameter expression="${component.org.codehaus.plexus.archiver.Archiver#jar}"
+ * @required
+ */
+ private JarArchiver jarArchiver;
+
+ /**
+ * The maven archive configuration to use.
+ *
+ * @parameter
+ */
+ private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
+
+ /**
+ * Classifier to add to the artifact generated. If given, the artifact will be an attachment instead.
+ *
+ * @parameter
+ */
+ private String classifier;
+
+ /**
+ * Whether this is the main artifact being built. Set to <code>false</code> if you don't want to install or deploy
+ * it to the local repository instead of the default one in an execution.
+ *
+ * @parameter expression="${primaryArtifact}" default-value="true"
+ */
+ private boolean primaryArtifact;
+
+ /**
+ * @component
+ */
+ private MavenProjectHelper projectHelper;
+
+ /**
+ * Executes the MarMojo on the current project.
+ *
+ * @throws MojoExecutionException
+ * if an error occured while building the webapp
+ */
+ public void execute() throws MojoExecutionException
+ {
+
+ File marFile = new File( outputDirectory, marName + ".mar" );
+
+ try
+ {
+ performPackaging( marFile );
+ }
+ catch ( Exception e )
+ {
+ throw new MojoExecutionException( "Error assembling mar", e );
+ }
+ }
+
+ /**
+ * Generates the mar.
+ *
+ * @param marFile
+ * the target mar file
+ * @throws IOException
+ * @throws ArchiverException
+ * @throws ManifestException
+ * @throws DependencyResolutionRequiredException
+ */
+ private void performPackaging( File marFile )
+ throws IOException, ArchiverException, ManifestException, DependencyResolutionRequiredException,
+ MojoExecutionException
+ {
+
+ buildExplodedMar( );
+
+ // generate mar file
+ getLog().info( "Generating mar " + marFile.getAbsolutePath() );
+ MavenArchiver archiver = new MavenArchiver();
+ archiver.setArchiver( jarArchiver );
+ archiver.setOutputFile( marFile );
+ jarArchiver.addDirectory( marDirectory );
+
+ // create archive
+ archiver.createArchive( project, archive );
+
+ if ( classifier != null )
+ {
+ projectHelper.attachArtifact( project, "mar", classifier, marFile );
+ }
+ else
+ {
+ Artifact artifact = project.getArtifact();
+ if ( primaryArtifact )
+ {
+ artifact.setFile( marFile );
+ }
+ else if ( artifact.getFile() == null || artifact.getFile().isDirectory() )
+ {
+ artifact.setFile( marFile );
+ }
+ else
+ {
+ projectHelper.attachArtifact( project, "mar", marFile );
+ }
+ }
+ }
+}
Added: webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/resources/META-INF/plexus/components.xml?view=auto&rev=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/resources/META-INF/plexus/components.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/main/resources/META-INF/plexus/components.xml Wed Nov 22 23:29:21 2006
@@ -0,0 +1,34 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+ <role-hint>mar</role-hint>
+ <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+ <configuration>
+ <classifier></classifier>
+ <extension>mar</extension>
+ <type>mar</type>
+ <packaging>jar</packaging>
+ <language>java</language>
+ <addedToClasspath>false</addedToClasspath>
+ </configuration>
+ </component>
+ <component>
+ <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+ <role-hint>mar</role-hint>
+ <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+ <configuration>
+ <phases>
+ <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
+ <compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
+ <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
+ <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
+ <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
+ <package>org.apache.axis2.maven2:axis2-mar-maven-plugin:mar</package>
+ <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+ <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+ </phases>
+ </configuration>
+ </component>
+ </components>
+</component-set>
Added: webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/configuration.apt
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/configuration.apt?view=auto&rev=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/configuration.apt (added)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/configuration.apt Wed Nov 22 23:29:21 2006
@@ -0,0 +1,98 @@
+Configuration
+
+ All Mar plugin goals takes the following configuration parameters as input:
+
+*------------------+----------------------------------+------------------------------------------------+
+| Parameter name | Default value | Description |
+*------------------+----------------------------------+------------------------------------------------+
+| marDirectory | ${project.build.directory}/mar | Directory where the mar 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. |
+*------------------+----------------------------------+------------------------------------------------+
+| moduleXmlFile | | Location of the module.xml file. By default, |
+| | | it is assumed that the file is already present |
+| | | in classesDirectory/META-INF and no special |
+| | | processing is required. |
+*------------------+----------------------------------+------------------------------------------------+
+
+
+The mar goal
+
+ The mar goal allows the following additional parameters:
+
+*------------------+----------------------------+------------------------------------------------+
+| Parameter name | Default value | Description |
+*------------------+----------------------------+------------------------------------------------+
+| outputDirectory | ${project.build.directory} | Directory where to generate the MAR file. |
+*------------------+----------------------------+------------------------------------------------+
+| marName | ${project.build.finalName} | The generated MAR 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 MAR 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 MAR file. A file set looks
+ as follows:
+
+-----------------
+ <fileSets>
+ <fileSet>
+ <directory>src/mar/files</directory>
+ <outputDirectory>META-INF/docs</outputDirectory>
+ <includes>
+ <include>**/*.html</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/mar/files</directory>
+ <outputDirectory>META-INF/etc</outputDirectory>
+ <excludes>
+ <exclude>**/*.html</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+-----------------
+
+ The example specifies, that the contents of the directory src/mar/files shall
+ be added to the MAR 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 MAR file. Defaults to the MAR |
+| | files root directory. |
+*---------------------+-------------------------------------------------------------------+
+| includes | Configures the set of files, which shall be included into the MAR |
+| | 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. |
+*---------------------+-------------------------------------------------------------------+
Added: webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/howto.apt
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/howto.apt?view=auto&rev=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/howto.apt (added)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/howto.apt Wed Nov 22 23:29:21 2006
@@ -0,0 +1,23 @@
+ ------
+ Maven 2 Mar Plugin: configuration examples
+ ------
+ Jochen Wiedmann
+ <jo...@gmail.com>
+ ------
+
+Goals
+
+ The Mar plugin allows the packaging of an Axis 2 service mar in 3 different modes:
+
+ * mar (default): generates the mar artifact
+
+ * inplace: package the mar in the source tree
+
+ * exploded : package an exploded mar application
+
+ Each mode is materialized by a goal. For instance, to generate an exploded
+ mar from the current project, one would type
+
++--------
+ mvn mar:exploded
++---------
Added: webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/introduction.apt
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/introduction.apt?view=auto&rev=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/introduction.apt (added)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/apt/introduction.apt Wed Nov 22 23:29:21 2006
@@ -0,0 +1,15 @@
+ ------
+ Maven 2 Aar Plugin
+ ------
+ Jochen Wiedmann
+ <jo...@gmail.com>
+ ------
+
+Introduction
+
+ This plugin generates an Axis 2 service file (AAR file).
+
+ The full description of goals is available {{{howto.html}here}}.
+
+
+
Added: webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/site.xml?view=auto&rev=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/site.xml (added)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-mar-maven-plugin/src/site/site.xml Wed Nov 22 23:29:21 2006
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+/*
+ * Copyright 2006 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 Axis 2 MAR Plugin">
+ <bannerLeft>
+ <name>Maven Axis 2 MAR 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="Apache" href="http://www.apache.org/"/>
+ <item name="Webservices" href="http://ws.apache.org/"/>
+ <item name="Axis 2" href="http://ws.apache.org/axis2/"/>
+ <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"/>
+ <item name="Configuration" href="configuration.html"/>
+ </menu>
+ ${reports}
+ </body>
+</project>
Modified: webservices/axis2/branches/java/1_1/modules/tool/axis2-wsdl2code-maven-plugin/src/test/java/org/apache/axis2/maven2/wsdl2code/WSDL2CodeMojoTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/tool/axis2-wsdl2code-maven-plugin/src/test/java/org/apache/axis2/maven2/wsdl2code/WSDL2CodeMojoTest.java?view=diff&rev=478500&r1=478499&r2=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/axis2-wsdl2code-maven-plugin/src/test/java/org/apache/axis2/maven2/wsdl2code/WSDL2CodeMojoTest.java (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/axis2-wsdl2code-maven-plugin/src/test/java/org/apache/axis2/maven2/wsdl2code/WSDL2CodeMojoTest.java Wed Nov 22 23:29:21 2006
@@ -24,7 +24,6 @@
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-import org.codehaus.plexus.util.FileUtils;
/**
* Test class for running the wsdl2code mojo.
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=478500&r1=478499&r2=478500
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/tool/pom.xml (original)
+++ webservices/axis2/branches/java/1_1/modules/tool/pom.xml Wed Nov 22 23:29:21 2006
@@ -42,6 +42,7 @@
<modules>
<module>axis2-aar-maven-plugin</module>
+ <module>axis2-mar-maven-plugin</module>
<module>axis2-java2wsdl-maven-plugin</module>
<module>axis2-wsdl2code-maven-plugin</module>
</modules>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org