[jboss-svn-commits] JBL Code SVN: r16997 - in labs/jbossbuild/maven-plugins/tags: maven-jboss-deploy-plugin-1.5 and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Dec 3 17:45:51 EST 2007


Author: pgier
Date: 2007-12-03 17:45:50 -0500 (Mon, 03 Dec 2007)
New Revision: 16997

Added:
   labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/
   labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/pom.xml
   labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/
   labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/CompInfoVerifyMojo.java
   labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/JBossDeployMojo.java
   labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/site/
   labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/site/apt/index.apt
Removed:
   labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/pom.xml
   labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/
   labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/CompInfoVerifyMojo.java
   labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/JBossDeployMojo.java
   labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/site/apt/index.apt
Log:
[maven-release-plugin]  copy for tag maven-jboss-deploy-plugin-1.5

Copied: labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5 (from rev 14449, labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin)

Deleted: labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/pom.xml
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/pom.xml	2007-08-22 16:00:11 UTC (rev 14449)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/pom.xml	2007-12-03 22:45:50 UTC (rev 16997)
@@ -1,70 +0,0 @@
-<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.jboss</groupId>
-    <artifactId>jboss-parent</artifactId>
-    <version>3</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.jboss.maven.plugins</groupId>
-  <artifactId>maven-jboss-deploy-plugin</artifactId>
-  <packaging>maven-plugin</packaging>
-  <name>JBoss Deploy Maven Plugin</name>
-  <version>1.4-SNAPSHOT</version>
-  <description>Plugin for deploying artifacts to JBoss non-maven repository.</description>
-  <scm>
-    <connection>scm:svn:https://svn.jboss.org/repos/labs/labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin</connection>
-  </scm>
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-release-plugin</artifactId>
-        <configuration>
-          <tagBase>https://svn.jboss.org/repos/labs/labs/jbossbuild/maven-plugins/tags</tagBase>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <repositories>
-    <repository>
-      <id>repository.jboss.org</id>
-      <name>JBoss Repository</name>
-      <url>http://repository.jboss.org/maven2/</url>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-    </repository>
-  </repositories>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-plugin-api</artifactId>
-      <version>2.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-project</artifactId>
-      <version>2.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-artifact</artifactId>
-      <version>2.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-model</artifactId>
-      <version>2.0</version>
-    </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <version>1.3.1</version>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>3.8.1</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-</project>
\ No newline at end of file

Copied: labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/pom.xml (from rev 16996, labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/pom.xml)
===================================================================
--- labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/pom.xml	                        (rev 0)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/pom.xml	2007-12-03 22:45:50 UTC (rev 16997)
@@ -0,0 +1,125 @@
+<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.jboss</groupId>
+    <artifactId>jboss-parent</artifactId>
+    <version>3</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jboss.maven.plugins</groupId>
+  <artifactId>maven-jboss-deploy-plugin</artifactId>
+  <packaging>maven-plugin</packaging>
+  <name>JBoss Deploy Maven Plugin</name>
+  <version>1.5</version>
+  <description>Plugin for deploying artifacts to JBoss ant/buildmagic repository.</description>
+  <url>http://labs.jboss.com/maven-jboss-deploy-plugin</url>
+  <scm>
+    <connection>scm:svn:https://svn.jboss.org/repos/labs/labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5</connection>
+  </scm>
+  <inceptionYear>2007</inceptionYear>
+  <issueManagement>
+    <system>jira</system>
+    <url>http://jira.jboss.com/jira/browse/JBBUILD</url>
+  </issueManagement>
+  <developers>
+    <developer>
+      <id>pgier</id>
+      <name>Paul Gier</name>
+      <organization>JBoss, a division of Red Hat, Inc</organization>
+      <timezone>-5</timezone>
+    </developer>
+  </developers>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-release-plugin</artifactId>
+        <configuration>
+          <tagBase>https://svn.jboss.org/repos/labs/labs/jbossbuild/maven-plugins/tags</tagBase>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  
+  <repositories>
+    <repository>
+      <id>repository.jboss.org</id>
+      <name>JBoss Repository</name>
+      <url>http://repository.jboss.org/maven2/</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+  
+  <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <minmemory>128m</minmemory>
+          <maxmemory>512</maxmemory>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+        <version>2.3</version>
+      </plugin>
+    </plugins>
+  </reporting>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-model</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>1.3.1</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  
+  <distributionManagement>
+    <repository>
+      <!-- Copy the distribution jar file to a local checkout of the maven repository 
+        -  This variable can be set in $MAVEN_HOME/conf/settings.xml -->
+      <id>repository.jboss.org</id>
+      <url>file://${maven.repository.root}</url>
+    </repository>
+    <snapshotRepository>
+      <id>snapshots.jboss.org</id>
+      <name>JBoss Snapshot Repository</name>
+      <url>dav:https://snapshots.jboss.org/maven2</url>
+    </snapshotRepository>
+    <site>
+      <id>www.jboss.org</id>
+      <name>www.jboss.org</name>
+      <!-- This should be set to a local checkout of the jboss.org/jbossretro freezone. -->
+      <url>file://${maven.jboss.deploy.plugin.site.root}</url>
+    </site>
+  </distributionManagement>
+  
+</project>
\ No newline at end of file

Copied: labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src (from rev 14448, labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src)

Deleted: labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/CompInfoVerifyMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/main/java/org/jboss/maven/plugins/deploy/CompInfoVerifyMojo.java	2007-08-22 13:19:20 UTC (rev 14448)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/CompInfoVerifyMojo.java	2007-12-03 22:45:50 UTC (rev 16997)
@@ -1,40 +0,0 @@
-package org.jboss.maven.plugins.deploy;
-
-import java.io.FileNotFoundException;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.xml.sax.SAXException;
-
-/**
- * Maven plugin for deploying to jboss repository.  By default
- * it will bind to the deploy phase.
- * 
- * @goal comp-info-verify
- * 
- */
-public class CompInfoVerifyMojo extends AbstractMojo
-{
-
-   /**
-    * Main execution path of the plugin.  Generates component-info.xml, and copies jar files to repository location.
-    * TODO: Should be able to call this mojo from command line to verify any component-info.xml.
-    */
-   public void execute() throws MojoExecutionException
-   {
-      this.getLog().debug("Executing JBoss deploy plugin");
-      String pathToCompInfo = System.getProperty("comp-info");
-      if (pathToCompInfo == null)
-      {
-         pathToCompInfo = "component-info.xml";
-      }
-      CompInfoVerifier verifier = new CompInfoVerifier();
-      try {
-         verifier.verifyCompInfo("component-info.xml");
-      } catch (FileNotFoundException fnfe) {
-         fnfe.printStackTrace();
-      } catch (SAXException saxe) {
-         saxe.printStackTrace();
-      }
-   }
-}

Copied: labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/CompInfoVerifyMojo.java (from rev 14493, labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/main/java/org/jboss/maven/plugins/deploy/CompInfoVerifyMojo.java)
===================================================================
--- labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/CompInfoVerifyMojo.java	                        (rev 0)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/CompInfoVerifyMojo.java	2007-12-03 22:45:50 UTC (rev 16997)
@@ -0,0 +1,52 @@
+package org.jboss.maven.plugins.deploy;
+
+import java.io.FileNotFoundException;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.xml.sax.SAXException;
+
+/**
+ * Maven plugin for verifying a component-info.xml file.
+ * By default it will search the current directory for
+ * a file called component-info.xml.
+ * Note: this goal in still in development.
+ * 
+ * @goal comp-info-verify
+ * 
+ */
+public class CompInfoVerifyMojo extends AbstractMojo
+{
+
+   /**
+    * The Maven Project Object
+    *
+    * @parameter expression="${project}"
+    * @required
+    * @readonly
+    */
+   protected MavenProject project;
+
+   /**
+    * Main execution path of the plugin.  Generates component-info.xml, and copies jar files to repository location.
+    * TODO: Should be able to call this mojo from command line to verify any component-info.xml.
+    */
+   public void execute() throws MojoExecutionException
+   {
+      this.getLog().debug("Executing JBoss deploy plugin");
+      String pathToCompInfo = System.getProperty("comp-info");
+      if (pathToCompInfo == null)
+      {
+         pathToCompInfo = "component-info.xml";
+      }
+      CompInfoVerifier verifier = new CompInfoVerifier();
+      try {
+         verifier.verifyCompInfo("component-info.xml");
+      } catch (FileNotFoundException fnfe) {
+         fnfe.printStackTrace();
+      } catch (SAXException saxe) {
+         saxe.printStackTrace();
+      }
+   }
+}

Deleted: labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/JBossDeployMojo.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/main/java/org/jboss/maven/plugins/deploy/JBossDeployMojo.java	2007-08-22 13:19:20 UTC (rev 14448)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/JBossDeployMojo.java	2007-12-03 22:45:50 UTC (rev 16997)
@@ -1,374 +0,0 @@
-package org.jboss.maven.plugins.deploy;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.License;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.xml.sax.SAXException;
-
-/**
- * Maven plugin for deploying to jboss repository.  By default
- * it will bind to the deploy phase.
- * 
- * @phase deploy
- * @goal jboss-deploy
- * 
- */
-public class JBossDeployMojo extends AbstractMojo
-{
-
-   private static String fileSep = System.getProperty("file.separator");
-
-   /**
-    * The Maven Project Object
-    *
-    * @parameter expression="${project}"
-    * @required
-    * @readonly
-    */
-   protected MavenProject project;
-
-   /**
-    * The Maven Project Helper Object
-    *
-    * @component
-    * @required
-    */
-   protected org.apache.maven.project.MavenProjectHelper projectHelper;
-
-   /**
-    * Source control information.
-    * @parameter expression="${project.scm}"
-    * @readonly
-    */
-   private org.apache.maven.model.Scm scm;
-
-   /**
-    * License information.
-    * @parameter expression="${project.licenses}"
-    * @required
-    * @readonly
-    */
-   private List licenses;
-
-   //private org.apache.maven.model.License license;
-
-   /**
-    * The Maven Plugin Object
-    *
-    * @parameter expression="${plugin.components}"
-    * @required
-    * @readonly
-    */
-   protected List pluginComponents;
-
-   /**
-    * Maven project properties.
-    *
-    * @parameter expression="${project.properties}"
-    * @required
-    * @readonly
-    */
-   protected Properties projectProperties;
-
-   /**
-    * This is the location that the jboss repository (non-maven) files will be copied to.
-    * @parameter
-    * @required
-    */
-   private String jbossDeployRoot;
-
-   /**
-    * If set to true, this will tell the plugin to generate a listing of imports based on the
-    * project dependencies.  Defaults to false;
-    * @parameter
-    */
-   private boolean generateImports;
-
-   /**
-    * This is the map of components that this project depends on.  If generateImports is set
-    * to true, the generated imports will be appended to the imports specified here.
-    * @parameter
-    */
-   private Map imports;
-
-   /**
-    * This is the list of artifacts exported from this project.
-    * By default the project artifact will be included in this list.
-    * If there is no project artifact, this plugin will look for an attached
-    * artifact that matches the project name, and attempt to attach it.
-    * The list of exports can manually be set with the following configuration.
-    * <exports>
-    *   <param>file1.jar</param>
-    *   <param>file2.jar</param>
-    * </exports>
-    * 
-    * @parameter
-    */
-   private Set<String> exports;
-
-   /**
-    * Main execution path of the plugin.  Generates component-info.xml, and copies jar files to repository location.
-    */
-   public void execute() throws MojoExecutionException
-   {
-      this.getLog().debug("Executing JBoss deploy plugin");
-
-      // Check that there is at least one artifact to deploy
-      if ((project.getArtifact() == null || project.getArtifact().getFile() == null)
-            && project.getAttachedArtifacts().size() == 0)
-      {
-         this.getLog().info("No artifacts to deploy for project:" + project.getName());
-         return;
-      }
-
-      if (exports == null) {
-         exports = new HashSet<String>();
-      }
-      String jbossGroupId = project.getGroupId().replace('.', '/');
-      // Initialize some local variables
-      File deployToDir = new File(jbossDeployRoot + fileSep + jbossGroupId + fileSep
-            + project.getArtifactId() + fileSep + project.getVersion() + fileSep);
-      File deployToLibDir = new File(deployToDir.getAbsolutePath() + fileSep + "lib" + fileSep);
-
-      // Load template file
-      InputStream templateInputStream = this.getClass().getResourceAsStream("component-info-template.txt");
-
-      if (templateInputStream == null)
-      {
-         this.getLog().error("Unable to load template file");
-         return;
-      }
-
-      StringBuffer compInfoTemplate = new StringBuffer();
-
-      try
-      {
-         compInfoTemplate.append(IOUtils.toString(templateInputStream));
-      }
-      catch (IOException ioe)
-      {
-         this.getLog().error("Unable to load component info template.");
-         this.getLog().error(ioe.toString());
-         throw new MojoExecutionException(ioe.getMessage());
-      }
-
-      // Evaluate the place holders in the template
-      String componentId = jbossGroupId + "/" + project.getArtifactId();
-      evaluateVariable(compInfoTemplate, "project.name", componentId + "-component-info");
-      evaluateVariable(compInfoTemplate, "component.id", componentId);
-      evaluateVariable(compInfoTemplate, "project.version", project.getVersion());
-      if (licenses.size() == 0)
-      {
-         getLog().warn("No license specified in pom.xml.  Default lgpl license will be used.");
-         evaluateVariable(compInfoTemplate, "project.license", "lgpl");
-      }
-      else
-      {
-         License firstLicense = (License) licenses.get(0);
-         evaluateVariable(compInfoTemplate, "project.license", firstLicense.getName());
-      }
-      if (project.getDescription() == null || project.getDescription().equals(""))
-      {
-         project.setDescription(project.getId());
-      }
-      evaluateVariable(compInfoTemplate, "project.description", project.getDescription());
-
-      if (scm == null || scm.getConnection() == null)
-      {
-         evaluateVariable(compInfoTemplate, "project.scm", "");
-      }
-      else
-      {
-         String scmConnStr = scm.getConnection().replaceFirst("scm:", "");
-         evaluateVariable(compInfoTemplate, "project.scm", "scm=\"" + scmConnStr + "\"");
-      }
-
-      // Build list of artifacts, copy them to the lib directory, and add them to component-info.xml
-      HashSet<String> artifactSet = new HashSet<String>();
-      Artifact projectArtifact = project.getArtifact();
-      if (projectArtifact != null && projectArtifact.getFile() != null)
-      {
-         artifactSet.add("    <artifact id=\"" + projectArtifact.getFile().getName() + "\"/>\n");
-         try
-         {
-            this.getLog().debug("Deploying file://" + deployToLibDir + fileSep + projectArtifact.getFile().getName());
-            FileUtils.copyFileToDirectory(projectArtifact.getFile(), deployToLibDir);
-         }
-         catch (IOException ioe)
-         {
-            throw new MojoExecutionException("Problem copying artifact: " + ioe.getMessage());
-         }
-      }
-
-      // Add the attached (non-default) artifacts
-      List list = project.getAttachedArtifacts();
-      this.getLog().debug("Number of attached artifacts: " + list.size());
-      
-      for (Object artifactObj : list)
-      {
-         Artifact artifact = (Artifact) artifactObj;
-         this.getLog().debug("Attaching artifact: " + artifact.getArtifactId());
-         
-         String classifierStr = artifact.getClassifier();
-         if (classifierStr == null) {
-            classifierStr = "";
-            // If the classifier is null and the artifactId matches the project
-            // the it must be a composite project, so we add the artifact to the
-            // list of exports.
-            if (artifact.getArtifactId().equals(project.getArtifactId())) {
-               exports.add(artifact.getArtifactId() + "." + artifact.getType());
-            }
-            if (project.getArtifact() != null) {
-               getLog().warn("Attached artifact with same name as default artifact.");
-               getLog().warn("This could be caused by an assembly descriptor with no id.");
-            }
-         }
-         String artifactLine = "    <artifact id=\"" + artifact.getFile().getName() + "\"/>\n";
-         
-         // Check for duplicates
-         if (artifactSet.contains(artifactLine)) {
-            this.getLog().warn(
-                  "Duplicate attached artifact found: " + artifact.getFile().getName()
-                        + ".jar");
-         }
-         artifactSet.add(artifactLine);
-         
-         try
-         {
-            this.getLog().debug("Deploying file://" + deployToLibDir + fileSep + artifact.getFile().getName());
-            FileUtils.copyFileToDirectory(artifact.getFile(), deployToLibDir);
-         }
-         catch (IOException ioe)
-         {
-            throw new MojoExecutionException("Problem copying artifact: " + ioe.getMessage());
-         }
-      }
-
-      StringBuffer artifacts = new StringBuffer();
-      for (String line : artifactSet)
-      {
-         artifacts.append(line);
-      }
-      evaluateVariable(compInfoTemplate, "artifacts", artifacts.toString());
-
-      // Create and set list of includes for export
-      StringBuffer exportsString = new StringBuffer();
-      if (project.getArtifact().getFile() != null)
-      {
-         exports.add(project.getArtifact().getFile().getName());
-      }
-      for (Object export : exports)
-      {
-         exportsString.append("      <include input=\"" + export + "\"/>\n");
-      }
-      evaluateVariable(compInfoTemplate, "includes", exportsString.toString());
-
-      // Generate the list of imports
-      evaluateVariable(compInfoTemplate, "imports", generateImportsString());
-
-      // Write the component info file
-      File compInfoFile = new File(deployToDir + fileSep + "component-info.xml");
-      try
-      {
-         if (!deployToDir.exists())
-         {
-            deployToDir.mkdirs();
-         }
-         FileWriter fw = new FileWriter(compInfoFile);
-         this.getLog().info("Deploying file: " + compInfoFile.getCanonicalPath());
-         fw.write(compInfoTemplate.toString());
-         fw.close();
-      }
-      catch (IOException ioe)
-      {
-         this.getLog().error(ioe);
-      }
-
-      CompInfoVerifier verifier = new CompInfoVerifier();
-      try
-      {
-         verifier.verifyCompInfo(new FileInputStream(compInfoFile));
-      }
-      catch (SAXException e)
-      {
-         this.getLog().warn(e);
-      }
-      catch (FileNotFoundException fnfe)
-      {
-         fnfe.printStackTrace();
-      }
-   }
-
-   /** 
-    * Creates the list of imports to include in the component-info.xml
-    */
-   private String generateImportsString()
-   {
-      StringBuffer importsString = new StringBuffer();
-      if (imports != null)
-      {
-         Set componentNames = imports.keySet();
-         for (Object component : componentNames)
-         {
-            importsString.append("    <import componentref=\"" + component.toString().replace('.', '/') + "\">\n");
-            importsString.append("      <compatible version=\"" + imports.get(component) + "\"/>\n");
-            importsString.append("    </import>\n");
-         }
-      }
-      if (this.generateImports)
-      {
-         List dependencies = project.getDependencies();
-         for (Object obj : dependencies)
-         {
-            Dependency dep = (Dependency) obj;
-            if (dep.getScope() == null || !dep.getScope().equals("test")) {
-               importsString.append("    <import componentref=\"" + dep.getGroupId().replace('.', '/') + "/"
-                     + dep.getArtifactId() + "\">\n");
-               importsString.append("      <compatible version=\"" + dep.getVersion() + "\"/>\n");
-               importsString.append("    </import>\n");
-            }
-         }
-      }
-      return importsString.toString();
-   }
-
-   
-   
-   /**
-    * Replace all instances of var with value in the given buffer.
-    * For example if var is "project.name", this method will search
-    * the buffer for "${project.name}" and replace it with the value
-    * provided.
-    * 
-    * @param buffer The buffer to be modified
-    * @param var The name of the variable to be evaluated.
-    * @param value The replacement string.
-    */
-   public void evaluateVariable(StringBuffer buffer, String var, String value)
-   {
-      int start = 0;
-      while ((start = buffer.indexOf("${" + var + "}")) != -1)
-      {
-         int end = start + ("${" + var + "}").length();
-         buffer.replace(start, end, value);
-      }
-   }
-
-}

Copied: labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/JBossDeployMojo.java (from rev 16986, labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/main/java/org/jboss/maven/plugins/deploy/JBossDeployMojo.java)
===================================================================
--- labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/JBossDeployMojo.java	                        (rev 0)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/main/java/org/jboss/maven/plugins/deploy/JBossDeployMojo.java	2007-12-03 22:45:50 UTC (rev 16997)
@@ -0,0 +1,410 @@
+package org.jboss.maven.plugins.deploy;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.License;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.xml.sax.SAXException;
+
+/**
+ * Maven plugin for deploying to jboss repository.  By default
+ * it will bind to the deploy phase.
+ * 
+ * @phase deploy
+ * @goal jboss-deploy
+ * 
+ */
+public class JBossDeployMojo extends AbstractMojo
+{
+
+   private static String fileSep = System.getProperty("file.separator");
+
+   /**
+    * The Maven Project Object
+    *
+    * @parameter expression="${project}"
+    * @required
+    * @readonly
+    */
+   protected MavenProject project;
+
+   /**
+    * Source control information.
+    * @parameter expression="${project.scm}"
+    * @readonly
+    */
+   private org.apache.maven.model.Scm scm;
+
+   /**
+    * License information from the pom.xml.
+    * @parameter expression="${project.licenses}"
+    * @required
+    * @readonly
+    */
+   private List pomLicenses;
+
+   /**
+    * Name of license to add to component-info.xml.  If no value is specified,
+    * then the first license from the pom.xml will be used.
+    * @parameter
+    */
+   private String license;
+
+   /**
+    * Boolean that determines if the artifact version should be included in the
+    * deployed jar files.
+    * @parameter default-value="false"
+    */
+   private boolean removeArtifactVersion;
+
+   /**
+    * Maven project properties.
+    *
+    * @parameter expression="${project.properties}"
+    * @required
+    * @readonly
+    */
+   protected Properties projectProperties;
+
+   /**
+    * This is the location that the jboss repository (non-maven) files will be copied to.
+    * @parameter expression="${jbossDeployRoot}"
+    * @required
+    */
+   private String jbossDeployRoot;
+
+   /**
+    * If set to true, this will tell the plugin to generate a listing of imports based on the
+    * project dependencies.  Defaults to false;
+    * @parameter
+    */
+   private boolean generateImports;
+
+   /**
+    * This is the map of components that this project depends on.  If generateImports is set
+    * to true, the generated imports will be appended to the imports specified here.
+    * @parameter
+    */
+   private Map imports;
+
+   /**
+    * This allows the maven groupId to be overridden.  For example, the pom groupId
+    * might be "org.jboss", but the jboss repository groupId should just be "jboss".
+    * @parameter
+    */
+   private String groupId;
+
+   /**
+    * This is the list of artifacts exported from this project.
+    * By default the project artifact will be included in this list.
+    * If there is no project artifact, this plugin will look for an attached
+    * artifact that matches the project name, and attempt to attach it.
+    * The list of exports can manually be set with the following configuration.
+    * <exports>
+    *   <param>file1.jar</param>
+    *   <param>file2.jar</param>
+    * </exports>
+    * 
+    * @parameter
+    */
+   private Set<String> exports;
+
+   /**
+    * Main execution path of the plugin.  Generates component-info.xml, and copies jar files to repository location.
+    */
+   public void execute() throws MojoExecutionException
+   {
+      this.getLog().debug("Executing JBoss deploy plugin");
+
+      // Check that there is at least one artifact to deploy
+      if ((project.getArtifact() == null || project.getArtifact().getFile() == null)
+            && project.getAttachedArtifacts().size() == 0)
+      {
+         this.getLog().info("No artifacts to deploy for project:" + project.getName());
+         return;
+      }
+
+      if (exports == null) {
+         exports = new HashSet<String>();
+      }
+      if (groupId == null || groupId.equals(""))
+      {
+         groupId = project.getGroupId();
+      }
+      String groupIdPath = groupId.replace('.', '/');
+      
+      // Initialize some local variables
+      File deployToDir = new File(jbossDeployRoot + fileSep + groupIdPath + fileSep
+            + project.getArtifactId() + fileSep + project.getVersion() + fileSep);
+      File deployToLibDir = new File(deployToDir.getAbsolutePath() + fileSep + "lib" + fileSep);
+
+      // Load template file
+      InputStream templateInputStream = this.getClass().getResourceAsStream("component-info-template.txt");
+
+      if (templateInputStream == null)
+      {
+         this.getLog().error("Unable to load template file");
+         return;
+      }
+
+      StringBuffer compInfoTemplate = new StringBuffer();
+
+      try
+      {
+         compInfoTemplate.append(IOUtils.toString(templateInputStream));
+      }
+      catch (IOException ioe)
+      {
+         this.getLog().error("Unable to load component info template.");
+         this.getLog().error(ioe.toString());
+         throw new MojoExecutionException(ioe.getMessage());
+      }
+
+      // Evaluate the place holders in the template
+      String componentId = groupIdPath + "/" + project.getArtifactId();
+      evaluateVariable(compInfoTemplate, "project.name", componentId + "-component-info");
+      evaluateVariable(compInfoTemplate, "component.id", componentId);
+      evaluateVariable(compInfoTemplate, "project.version", project.getVersion());
+      if (license != null && ( ! license.equals(""))) 
+      {
+         evaluateVariable(compInfoTemplate, "project.license", license);
+      }
+      else if (pomLicenses.size() == 0)
+      {
+         getLog().warn("No license specified.  Default lgpl license will be used.");
+         evaluateVariable(compInfoTemplate, "project.license", "lgpl");
+      }
+      else
+      {
+         License firstLicense = (License) pomLicenses.get(0);
+         evaluateVariable(compInfoTemplate, "project.license", firstLicense.getName());
+      }
+      
+      if (project.getDescription() == null || project.getDescription().equals(""))
+      {
+         project.setDescription(project.getId());
+      }
+      evaluateVariable(compInfoTemplate, "project.description", project.getDescription());
+
+      if (scm == null || scm.getConnection() == null)
+      {
+         evaluateVariable(compInfoTemplate, "project.scm", "");
+      }
+      else
+      {
+         String scmConnStr = scm.getConnection().replaceFirst("scm:", "");
+         evaluateVariable(compInfoTemplate, "project.scm", "scm=\"" + scmConnStr + "\"");
+      }
+
+      // Build list of artifacts, copy them to the lib directory, and add them to component-info.xml
+      HashSet<String> artifactSet = new HashSet<String>();
+      Artifact projectArtifact = project.getArtifact();
+      if (projectArtifact != null && projectArtifact.getFile() != null)
+      {
+         String deployFileName = generateOutputFileName(projectArtifact, removeArtifactVersion);
+         artifactSet.add("    <artifact id=\"" + deployFileName + "\"/>\n");
+         try
+         {
+            this.getLog().debug("Deploying file://" + deployToLibDir + fileSep + deployFileName);
+            FileUtils.copyFile(projectArtifact.getFile(), new File(deployToLibDir, deployFileName));
+         }
+         catch (IOException ioe)
+         {
+            throw new MojoExecutionException("Problem copying artifact: " + ioe.getMessage());
+         }
+      }
+
+      // Add the attached (non-default) artifacts
+      List list = project.getAttachedArtifacts();
+      this.getLog().debug("Number of attached artifacts: " + list.size());
+      
+      for (Object artifactObj : list)
+      {
+         Artifact artifact = (Artifact) artifactObj;
+         this.getLog().debug("Attaching artifact: " + artifact.getArtifactId());
+         
+         String classifierStr = artifact.getClassifier();
+         if (classifierStr == null) {
+            classifierStr = "";
+            // If the classifier is null and the artifactId matches the project artifactId
+            // it must be a composite project, so we add the artifact to the
+            // list of exports.
+            if (artifact.getArtifactId().equals(project.getArtifactId())) {
+               exports.add(artifact.getArtifactId() + "." + artifact.getType());
+            }
+            if (project.getArtifact() != null) {
+               getLog().warn("Attached artifact with same classifier as default artifact." + "\n"
+                     + "Attached artifact: " + artifact.getFile() + "\n"
+                     + "Project artifact: " + project.getArtifact().getFile() + "\n"
+                     + "This could be caused by an assembly descriptor with no id.");
+            }
+         }
+         String deployFileName = generateOutputFileName(artifact, removeArtifactVersion);
+         String artifactLine = "    <artifact id=\"" + deployFileName + "\"/>\n";
+         
+         // Check for duplicates
+         if (artifactSet.contains(artifactLine)) {
+            this.getLog().warn(
+                  "Duplicate attached artifact found: " + artifact.getFile().getName()
+                        + ".jar");
+         }
+         artifactSet.add(artifactLine);
+         
+         try
+         {
+            this.getLog().debug("Deploying file://" + deployToLibDir + fileSep + deployFileName);
+            File deploytoFile = new File(deployToLibDir, deployFileName);
+            FileUtils.copyFile(artifact.getFile(), deploytoFile);
+         }
+         catch (IOException ioe)
+         {
+            throw new MojoExecutionException("Problem copying artifact: " + ioe.getMessage());
+         }
+      }
+
+      StringBuffer artifacts = new StringBuffer();
+      for (String line : artifactSet)
+      {
+         artifacts.append(line);
+      }
+      evaluateVariable(compInfoTemplate, "artifacts", artifacts.toString());
+
+      // Create and set list of includes for export
+      StringBuffer exportsString = new StringBuffer();
+      if (project.getArtifact().getFile() != null)
+      {
+         exports.add(generateOutputFileName(project.getArtifact(), removeArtifactVersion));
+      }
+      for (Object export : exports)
+      {
+         exportsString.append("      <include input=\"" + export + "\"/>\n");
+      }
+      evaluateVariable(compInfoTemplate, "includes", exportsString.toString());
+
+      // Generate the list of imports
+      evaluateVariable(compInfoTemplate, "imports", generateImportsString());
+
+      // Write the component info file
+      File compInfoFile = new File(deployToDir + fileSep + "component-info.xml");
+      try
+      {
+         if (!deployToDir.exists())
+         {
+            deployToDir.mkdirs();
+         }
+         FileWriter fw = new FileWriter(compInfoFile);
+         this.getLog().info("Deploying file: " + compInfoFile.getCanonicalPath());
+         fw.write(compInfoTemplate.toString());
+         fw.close();
+      }
+      catch (IOException ioe)
+      {
+         this.getLog().error(ioe);
+      }
+
+      CompInfoVerifier verifier = new CompInfoVerifier();
+      try
+      {
+         verifier.verifyCompInfo(new FileInputStream(compInfoFile));
+      }
+      catch (SAXException e)
+      {
+         this.getLog().warn(e);
+      }
+      catch (FileNotFoundException fnfe)
+      {
+         fnfe.printStackTrace();
+      }
+   }
+
+   private String generateOutputFileName(Artifact artifact, boolean removeArtifactVersion)
+   {
+      String deployFileName = artifact.getFile().getName();
+      if (removeArtifactVersion)
+      {
+         if ( deployFileName.contains( artifact.getBaseVersion() ) )
+         {
+            deployFileName = deployFileName.replace( ("-" + artifact.getBaseVersion()), "" );
+         }
+      }
+      return deployFileName;
+      
+   }
+   
+   /** 
+    * Creates the list of imports to include in the component-info.xml
+    */
+   private String generateImportsString()
+   {
+      StringBuffer importsString = new StringBuffer();
+      if (imports != null)
+      {
+         Set componentNames = imports.keySet();
+         for (Object component : componentNames)
+         {
+            importsString.append("    <import componentref=\"" + component.toString().replace('.', '/') + "\">\n");
+            String componentVersions = imports.get(component).toString();
+            String [] versions = componentVersions.split(",");
+            for(String version : versions)
+            {
+               importsString.append("      <compatible version=\"" + version.trim() + "\"/>\n");
+            }
+            importsString.append("    </import>\n");
+         }
+      }
+      if (this.generateImports)
+      {
+         List dependencies = project.getDependencies();
+         for (Object obj : dependencies)
+         {
+            Dependency dep = (Dependency) obj;
+            if (dep.getScope() == null || !dep.getScope().equals("test")) {
+               importsString.append("    <import componentref=\"" + dep.getGroupId().replace('.', '/') + "/"
+                     + dep.getArtifactId() + "\">\n");
+               importsString.append("      <compatible version=\"" + dep.getVersion() + "\"/>\n");
+               importsString.append("    </import>\n");
+            }
+         }
+      }
+      return importsString.toString();
+   }
+
+   
+   
+   /**
+    * Replace all instances of var with value in the given buffer.
+    * For example if var is "project.name", this method will search
+    * the buffer for "${project.name}" and replace it with the value
+    * provided.
+    * 
+    * @param buffer The buffer to be modified
+    * @param var The name of the variable to be evaluated.
+    * @param value The replacement string.
+    */
+   public void evaluateVariable(StringBuffer buffer, String var, String value)
+   {
+      int start = 0;
+      while ((start = buffer.indexOf("${" + var + "}")) != -1)
+      {
+         int end = start + ("${" + var + "}").length();
+         buffer.replace(start, end, value);
+      }
+   }
+
+}

Copied: labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/site (from rev 14489, labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/site)

Deleted: labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/site/apt/index.apt
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/site/apt/index.apt	2007-08-23 16:31:30 UTC (rev 14489)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/site/apt/index.apt	2007-12-03 22:45:50 UTC (rev 16997)
@@ -1,37 +0,0 @@
- ------
- Introduction
- ------
- Paul Gier
- ------
- 23 August 2007
- ------
-
-~~ Copyright © 2007  Red Hat Middleware, LLC. All rights reserved.
-~~
-~~ This copyrighted material is made available to anyone wishing to use, modify,
-~~ copy, or redistribute it subject to the terms and conditions of the GNU
-~~ Lesser General Public License, v. 2.1. This program is distributed in the
-~~ hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
-~~ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-~~ Lesser General Public License for more details. You should have received a
-~~ copy of the GNU Lesser General Public License, v.2.1 along with this
-~~ distribution; if not, write to the Free Software Foundation, Inc.,
-~~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-~~
-~~ Red Hat Author(s): Paul Gier
-
-jboss-deploy Plugin
-
-    This plugin allows maven based projects to deploy project artifacts (jars, etc) 
-    to the legacy ant/buildmagic based repository.  Deployment to the standard maven 
-    repository should be done using the standard maven-deploy-plugin.  The main
-    features of this plugin include generating a component-info.xml file, and 
-    copying project artifacts to a local directory which contains a checkout of
-    the ant repository.
-    
-    Note: when using this plugin it may be necessary to visually inspect the generated
-    component-info.xml file to be sure that everything is correct.
-
-* Usage
-
-    Detailed usage instructions for the <jboss-deploy Plugin> can be found {{{usage.html}here}}.

Copied: labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/site/apt/index.apt (from rev 14495, labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/site/apt/index.apt)
===================================================================
--- labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/site/apt/index.apt	                        (rev 0)
+++ labs/jbossbuild/maven-plugins/tags/maven-jboss-deploy-plugin-1.5/src/site/apt/index.apt	2007-12-03 22:45:50 UTC (rev 16997)
@@ -0,0 +1,59 @@
+ ------
+ Introduction
+ ------
+ Paul Gier
+ ------
+ 23 August 2007
+ ------
+
+~~ Copyright © 2007  Red Hat Middleware, LLC. All rights reserved.
+~~
+~~ This copyrighted material is made available to anyone wishing to use, modify,
+~~ copy, or redistribute it subject to the terms and conditions of the GNU
+~~ Lesser General Public License, v. 2.1. This program is distributed in the
+~~ hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
+~~ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+~~ Lesser General Public License for more details. You should have received a
+~~ copy of the GNU Lesser General Public License, v.2.1 along with this
+~~ distribution; if not, write to the Free Software Foundation, Inc.,
+~~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+~~
+~~ Red Hat Author(s): Paul Gier
+
+jboss-deploy Plugin
+
+    This plugin allows maven based projects to deploy project artifacts (jars, etc) 
+    to the legacy ant/buildmagic based repository.  Deployment to the standard maven 
+    repository should be done using the standard maven-deploy-plugin.  The main
+    features of this plugin include generating a component-info.xml file, and 
+    copying project artifacts to a local directory which contains a checkout of
+    the ant repository.
+    
+    Note: when using this plugin it may be necessary to visually inspect the generated
+    component-info.xml file to be sure that everything is correct.
+
+* Usage
+
+* Minimal configuration
+
+    The most basic configuration of the plugin is to simply tell the plugin
+    the default goal to execute and where to deploy artifacts:
+
++----+
+      <plugin>
+        <groupId>org.jboss.maven.plugins</groupId>
+        <artifactId>maven-jboss-deploy-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>jboss-deploy</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <jbossDeployRoot>file:///path/to/deploy</jbossDeployRoot>
+        </configuration>
+      </plugin>
++----+
+
+    Additional information and examples can be found {{{usage.html}here}}.




More information about the jboss-svn-commits mailing list