You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2010/08/01 21:54:36 UTC

svn commit: r981293 - in /axis/axis2/java/core/trunk/modules: distribution/ distribution/src/main/assembly/ tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/

Author: veithen
Date: Sun Aug  1 19:54:36 2010
New Revision: 981293

URL: http://svn.apache.org/viewvc?rev=981293&view=rev
Log:
Enhanced axis2-repo-maven-plugin with options to strip version numbers from AAR and MAR files. Use this to get rid of the Groovy stuff and some of the assembly stuff in the distribution module.

Removed:
    axis/axis2/java/core/trunk/modules/distribution/src/main/assembly/repository.xml
Modified:
    axis/axis2/java/core/trunk/modules/distribution/pom.xml
    axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java
    axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/ArchiveDeployer.java

Modified: axis/axis2/java/core/trunk/modules/distribution/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/distribution/pom.xml?rev=981293&r1=981292&r2=981293&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/distribution/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/distribution/pom.xml Sun Aug  1 19:54:36 2010
@@ -192,57 +192,16 @@
     <build>
         <plugins>
             <plugin>
-                <!-- This builds the Axis2 repository with the modules and services -->
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <phase>generate-resources</phase>
-                        <goals>
-                            <goal>directory-single</goal>
-                        </goals>
-                        <configuration>
-                            <outputDirectory>${project.build.directory}</outputDirectory>
-                            <finalName>tmp-repository</finalName>
-                            <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
-                            <appendAssemblyId>false</appendAssemblyId>
-                            <descriptors>
-                                <descriptor>src/main/assembly/repository.xml</descriptor>
-                            </descriptors>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <!-- This generates the modules.list and services.list files -->
-                <groupId>org.codehaus.gmaven</groupId>
-                <artifactId>gmaven-plugin</artifactId>
+                <groupId>org.apache.axis2</groupId>
+                <artifactId>axis2-repo-maven-plugin</artifactId>
                 <executions>
                     <execution>
-                        <phase>generate-resources</phase>
                         <goals>
-                            <goal>execute</goal>
+                            <goal>create-repository</goal>
                         </goals>
                         <configuration>
-                            <source>
-                                def modulesdir = new File(project.build.directory, "tmp-repository/modules");
-                                def moduleslist = new File(modulesdir, "modules.list");
-                                moduleslist.delete();
-                                modulesdir.eachFile({
-                                    if (it.name.endsWith(".mar")) {
-                                        moduleslist.append("$it.name\n");
-                                    }
-                                })
-                                
-                                def servicesdir = new File(project.build.directory, "tmp-repository/services");
-                                def serviceslist = new File(servicesdir, "services.list");
-                                serviceslist.delete();
-                                servicesdir.eachFile({
-                                    if (it.name.endsWith(".aar")) {
-                                        serviceslist.append("$it.name\n");
-                                    }
-                                })
-                            </source>
+                            <outputDirectory>${project.build.directory}/tmp-repository</outputDirectory>
+                            <generateFileLists>true</generateFileLists>
                         </configuration>
                     </execution>
                 </executions>

Modified: axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java?rev=981293&r1=981292&r2=981293&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java (original)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/AbstractCreateRepositoryMojo.java Sun Aug  1 19:54:36 2010
@@ -136,6 +136,20 @@ public abstract class AbstractCreateRepo
      */
     private boolean generateFileLists;
     
+    /**
+     * Specifies whether the plugin strips version numbers from AAR files.
+     * 
+     * @parameter default-value="true"
+     */
+    private boolean stripServiceVersion;
+    
+    /**
+     * Specifies whether the plugin strips version numbers from MAR files.
+     * 
+     * @parameter default-value="false"
+     */
+    private boolean stripModuleVersion;
+    
     protected abstract String getScope();
     
     protected abstract File getOutputDirectory();
@@ -162,8 +176,8 @@ public abstract class AbstractCreateRepo
         artifacts = replaceIncompleteArtifacts(artifacts);
         File outputDirectory = getOutputDirectory();
         Map<String,ArchiveDeployer> deployers = new HashMap<String,ArchiveDeployer>();
-        deployers.put("aar", new ArchiveDeployer(outputDirectory, servicesDirectory, "services.list", generateFileLists));
-        deployers.put("mar", new ArchiveDeployer(outputDirectory, modulesDirectory, "modules.list", generateFileLists));
+        deployers.put("aar", new ArchiveDeployer(outputDirectory, servicesDirectory, "services.list", generateFileLists, stripServiceVersion));
+        deployers.put("mar", new ArchiveDeployer(outputDirectory, modulesDirectory, "modules.list", generateFileLists, stripModuleVersion));
         for (Artifact artifact : artifacts) {
             String type = artifact.getType();
             ArchiveDeployer deployer = deployers.get(type);

Modified: axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/ArchiveDeployer.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/ArchiveDeployer.java?rev=981293&r1=981292&r2=981293&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/ArchiveDeployer.java (original)
+++ axis/axis2/java/core/trunk/modules/tool/axis2-repo-maven-plugin/src/main/java/org/apache/axis2/maven2/repo/ArchiveDeployer.java Sun Aug  1 19:54:36 2010
@@ -40,16 +40,25 @@ public class ArchiveDeployer {
     private final File directory;
     private final String fileListName;
     private final boolean generateFileList;
+    private final boolean stripVersion;
     private final List<String> files = new ArrayList<String>();
     
-    public ArchiveDeployer(File repositoryDirectory, String directory, String fileListName, boolean generateFileList) {
+    public ArchiveDeployer(File repositoryDirectory, String directory, String fileListName, boolean generateFileList, boolean stripVersion) {
         this.directory = new File(repositoryDirectory, directory);
         this.fileListName = fileListName;
         this.generateFileList = generateFileList;
+        this.stripVersion = stripVersion;
     }
     
     public void deploy(Log log, Artifact artifact) throws MojoExecutionException {
-        String destFileName = artifact.getArtifactId() + "-" + artifact.getVersion() + "." + artifact.getType();
+        StringBuilder buffer = new StringBuilder(artifact.getArtifactId());
+        if (!stripVersion) {
+            buffer.append("-");
+            buffer.append(artifact.getVersion());
+        }
+        buffer.append(".");
+        buffer.append(artifact.getType());
+        String destFileName = buffer.toString();
         log.info("Adding " + destFileName);
         try {
             FileUtils.copyFile(artifact.getFile(), new File(directory, destFileName));