[jboss-svn-commits] JBL Code SVN: r17323 - in labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin: src/it and 8 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Dec 19 12:39:22 EST 2007
Author: pgier
Date: 2007-12-19 12:39:21 -0500 (Wed, 19 Dec 2007)
New Revision: 17323
Added:
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/pom.xml
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/java/
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/java/foo/
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/java/foo/project003/
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/java/foo/project003/App.java
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/resources/
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/resources/default-configuration.properties
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/resources/excluded-file.txt
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/verify.bsh
Modified:
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/pom.xml
labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/main/java/org/jboss/maven/plugins/deploy/JBossDeployMojo.java
Log:
[JBBUILD-437] Adding option to rename artifactId. Also adding a test for this feature.
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/pom.xml
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/pom.xml 2007-12-19 17:32:46 UTC (rev 17322)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/pom.xml 2007-12-19 17:39:21 UTC (rev 17323)
@@ -102,6 +102,80 @@
</dependency>
</dependencies>
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>install-file</goal>
+ </goals>
+ <configuration>
+ <file>${project.build.directory}/${project.build.finalName}.jar</file>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.artifactId}</artifactId>
+ <version>${project.version}</version>
+ <packaging>${project.packaging}</packaging>
+ <pomFile>${basedir}/pom.xml</pomFile>
+ <createChecksum>true</createChecksum>
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <localRepositoryId>it-local-repo</localRepositoryId>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <configuration>
+ <projectsDirectory>src/it</projectsDirectory>
+ <pomIncludes>
+ <pomInclude>**/**/pom.xml</pomInclude>
+ </pomIncludes>
+ <postBuildHookScript>verify.bsh</postBuildHookScript>
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <goals>
+ <goal>clean</goal>
+ <goal>package</goal>
+ </goals>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <!-- TODO remove when invoker plugin is released -->
+ <pluginRepositories>
+ <pluginRepository>
+ <id>apache.snapshots</id>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+
<distributionManagement>
<repository>
<!-- Copy the distribution jar file to a local checkout of the maven repository
Property changes on: labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion
___________________________________________________________________
Name: svn:ignore
+ target
Added: labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/pom.xml
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/pom.xml (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/pom.xml 2007-12-19 17:39:21 UTC (rev 17323)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jboss-deploy-plugin-artifact-rename</artifactId>
+ <version>99.0</version>
+ <name>Maven</name>
+ <packaging>jar</packaging>
+ <description>Change the default artifactId</description>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jboss-deploy-plugin</artifactId>
+ <version>@pom.version@</version>
+ <executions>
+ <execution>
+ <id>test-execution</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jboss-deploy</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <jbossDeployRoot>${project.build.directory}/jboss-ant-repo</jbossDeployRoot>
+ <artifactId>new-artifact-id</artifactId>
+ <removeArtifactVersion>true</removeArtifactVersion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/java/foo/project003/App.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/java/foo/project003/App.java (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/java/foo/project003/App.java 2007-12-19 17:39:21 UTC (rev 17323)
@@ -0,0 +1,32 @@
+package foo.project003;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+/**
+ * Hello world!
+ *
+ */
+public class App
+{
+ public static void main( String[] args )
+ {
+ System.out.println( "Hello World!" );
+ }
+}
Added: labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/resources/default-configuration.properties
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/resources/default-configuration.properties (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/resources/default-configuration.properties 2007-12-19 17:39:21 UTC (rev 17323)
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
Added: labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/resources/excluded-file.txt
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/resources/excluded-file.txt (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/src/main/resources/excluded-file.txt 2007-12-19 17:39:21 UTC (rev 17323)
@@ -0,0 +1 @@
+This file is excluded by the custom configuration, so shouldn't end up in the end product
\ No newline at end of file
Added: labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/verify.bsh
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/verify.bsh (rev 0)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/verify.bsh 2007-12-19 17:39:21 UTC (rev 17323)
@@ -0,0 +1,58 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.*;
+import java.util.*;
+import java.util.jar.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+ File repo = new File( basedir, "target/jboss-ant-repo" );
+ if ( !repo.exists() || !repo.isDirectory() )
+ {
+ System.err.println( "jboss ant repo file is missing or not a directory." );
+ return false;
+ }
+
+ File componentInfo = new File ( repo, "org/jboss/maven/plugins/new-artifact-id/99.0/component-info.xml" );
+ if ( !componentInfo.exists() )
+ {
+ System.err.println( "component-info.xml file is missing or a directory." );
+ return false;
+ }
+
+ File outputJar = new File ( repo, "org/jboss/maven/plugins/new-artifact-id/99.0/lib/new-artifact-id.jar" );
+ if ( !outputJar.exists() )
+ {
+ System.err.println( outputJar + " file is missing." );
+ return false;
+ }
+
+}
+catch( Throwable e )
+{
+ e.printStackTrace();
+ result = false;
+}
+
+return result;
Property changes on: labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/it/artifact-rename-noversion/verify.bsh
___________________________________________________________________
Name: svn:executable
+ *
Modified: labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/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-12-19 17:32:46 UTC (rev 17322)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jboss-deploy-plugin/src/main/java/org/jboss/maven/plugins/deploy/JBossDeployMojo.java 2007-12-19 17:39:21 UTC (rev 17323)
@@ -104,9 +104,16 @@
private Map imports;
/**
+ * This allows the maven artifactId to be overridden. For example, the pom artifactId
+ * might be "jboss-metadata", but the jboss repository artifactId should just be "metadata".
+ * @parameter expression="${project.artifactId}"
+ */
+ private String artifactId;
+
+ /**
* 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
+ * @parameter expression="${project.groupId}"
*/
private String groupId;
@@ -143,15 +150,11 @@
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);
+ + artifactId + fileSep + project.getVersion() + fileSep);
File deployToLibDir = new File(deployToDir.getAbsolutePath() + fileSep + "lib" + fileSep);
// Load template file
@@ -177,7 +180,7 @@
}
// Evaluate the place holders in the template
- String componentId = groupIdPath + "/" + project.getArtifactId();
+ String componentId = groupIdPath + "/" + artifactId;
evaluateVariable(compInfoTemplate, "project.name", componentId + "-component-info");
evaluateVariable(compInfoTemplate, "component.id", componentId);
evaluateVariable(compInfoTemplate, "project.version", project.getVersion());
@@ -246,7 +249,7 @@
// 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());
+ exports.add(artifactId + "." + artifact.getType());
}
if (project.getArtifact() != null) {
getLog().warn("Attached artifact with same classifier as default artifact." + "\n"
@@ -343,6 +346,14 @@
deployFileName = deployFileName.replace( ("-" + artifact.getBaseVersion()), "" );
}
}
+ // Check if the artifactId was customized
+ if ( ! project.getArtifactId().equals(artifactId))
+ {
+ if ( deployFileName.contains( project.getArtifactId() ) )
+ {
+ deployFileName = deployFileName.replace(project.getArtifactId(), artifactId);
+ }
+ }
return deployFileName;
}
More information about the jboss-svn-commits
mailing list