You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sn...@apache.org on 2011/03/21 07:10:25 UTC
svn commit: r1083681 - in /maven/plugins/trunk: ./ maven-acr-plugin/
maven-acr-plugin/src/ maven-acr-plugin/src/it/
maven-acr-plugin/src/it/it-01/ maven-acr-plugin/src/it/it-01/src/
maven-acr-plugin/src/it/it-01/src/main/ maven-acr-plugin/src/it/it-01/...
Author: snicoll
Date: Mon Mar 21 06:10:23 2011
New Revision: 1083681
URL: http://svn.apache.org/viewvc?rev=1083681&view=rev
Log:
MACR-1: Initial version of the plugin
Added:
maven/plugins/trunk/maven-acr-plugin/ (with props)
maven/plugins/trunk/maven-acr-plugin/pom.xml
maven/plugins/trunk/maven-acr-plugin/src/
maven/plugins/trunk/maven-acr-plugin/src/it/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/pom.xml
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/java/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/java/org/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/java/org/apache/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/java/org/apache/maven/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/java/org/apache/maven/plugin/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/java/org/apache/maven/plugin/acr/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/java/org/apache/maven/plugin/acr/it/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/java/org/apache/maven/plugin/acr/it/it01/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/java/org/apache/maven/plugin/acr/it/it01/SampleApp.java
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/resources/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/resources/META-INF/
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/resources/META-INF/application-client.xml
maven/plugins/trunk/maven-acr-plugin/src/it/it-01/verify.bsh
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/pom.xml
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/java/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/java/org/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/java/org/apache/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/java/org/apache/maven/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/java/org/apache/maven/plugin/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/java/org/apache/maven/plugin/acr/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/java/org/apache/maven/plugin/acr/it/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/java/org/apache/maven/plugin/acr/it/it02/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/java/org/apache/maven/plugin/acr/it/it02/SampleApp.java
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/resources/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/resources/META-INF/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/resources/META-INF/application-client.xml
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/pom.xml
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/java/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/java/org/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/java/org/apache/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/java/org/apache/maven/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/java/org/apache/maven/plugin/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/java/org/apache/maven/plugin/acr/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/java/org/apache/maven/plugin/acr/it/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/java/org/apache/maven/plugin/acr/it/it02/
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/java/org/apache/maven/plugin/acr/it/it02/DependencyTest.java
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/pom.xml
maven/plugins/trunk/maven-acr-plugin/src/it/it-02/verify.bsh
maven/plugins/trunk/maven-acr-plugin/src/it/it-03/
maven/plugins/trunk/maven-acr-plugin/src/it/it-03/pom.xml
maven/plugins/trunk/maven-acr-plugin/src/it/it-03/src/
maven/plugins/trunk/maven-acr-plugin/src/it/it-03/src/main/
maven/plugins/trunk/maven-acr-plugin/src/it/it-03/src/main/resources/
maven/plugins/trunk/maven-acr-plugin/src/it/it-03/src/main/resources/META-INF/
maven/plugins/trunk/maven-acr-plugin/src/it/it-03/src/main/resources/META-INF/application-client.xml
maven/plugins/trunk/maven-acr-plugin/src/it/it-03/verify.bsh
- copied, changed from r1081277, maven/plugins/trunk/maven-ejb-plugin/src/it/mejb-34-filtered/verify.bsh
maven/plugins/trunk/maven-acr-plugin/src/it/it-04/
maven/plugins/trunk/maven-acr-plugin/src/it/it-04/pom.xml
maven/plugins/trunk/maven-acr-plugin/src/it/it-04/src/
maven/plugins/trunk/maven-acr-plugin/src/it/it-04/src/main/
maven/plugins/trunk/maven-acr-plugin/src/it/it-04/src/main/resources/
maven/plugins/trunk/maven-acr-plugin/src/it/it-04/src/main/resources/META-INF/
maven/plugins/trunk/maven-acr-plugin/src/it/it-04/src/main/resources/META-INF/application-client.xml
maven/plugins/trunk/maven-acr-plugin/src/it/it-04/verify.bsh
- copied, changed from r1081277, maven/plugins/trunk/maven-ejb-plugin/src/it/mejb-34-filtered/verify.bsh
maven/plugins/trunk/maven-acr-plugin/src/it/settings.xml
- copied unchanged from r1081277, maven/plugins/trunk/maven-ejb-plugin/src/it/settings.xml
maven/plugins/trunk/maven-acr-plugin/src/main/
maven/plugins/trunk/maven-acr-plugin/src/main/java/
maven/plugins/trunk/maven-acr-plugin/src/main/java/org/
maven/plugins/trunk/maven-acr-plugin/src/main/java/org/apache/
maven/plugins/trunk/maven-acr-plugin/src/main/java/org/apache/maven/
maven/plugins/trunk/maven-acr-plugin/src/main/java/org/apache/maven/plugin/
maven/plugins/trunk/maven-acr-plugin/src/main/java/org/apache/maven/plugin/acr/
maven/plugins/trunk/maven-acr-plugin/src/main/java/org/apache/maven/plugin/acr/AcrMojo.java
maven/plugins/trunk/maven-acr-plugin/src/main/resources/
maven/plugins/trunk/maven-acr-plugin/src/main/resources/META-INF/
maven/plugins/trunk/maven-acr-plugin/src/main/resources/META-INF/plexus/
maven/plugins/trunk/maven-acr-plugin/src/main/resources/META-INF/plexus/components.xml
Modified:
maven/plugins/trunk/pom.xml
Propchange: maven/plugins/trunk/maven-acr-plugin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar 21 06:10:23 2011
@@ -0,0 +1,3 @@
+*.iml
+
+target
Added: maven/plugins/trunk/maven-acr-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/pom.xml?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/pom.xml (added)
+++ maven/plugins/trunk/maven-acr-plugin/pom.xml Mon Mar 21 06:10:23 2011
@@ -0,0 +1,158 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugins</artifactId>
+ <version>19</version>
+ </parent>
+
+ <artifactId>maven-acr-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <name>Maven ACR Plugin</name>
+ <description>Generates a J2EE Application Client file.</description>
+
+ <prerequisites>
+ <maven>2.0.6</maven>
+ </prerequisites>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-acr-plugin/</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-acr-plugin/
+ </developerConnection>
+ <url>http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/</url>
+ </scm>
+ <issueManagement>
+ <system>JIRA</system>
+ <url>http://jira.codehaus.org/browse/MACR</url>
+ </issueManagement>
+
+ <properties>
+ <mavenVersion>2.2.1</mavenVersion>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>${mavenVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ <version>2.4.1</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-filtering</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-interpolation</artifactId>
+ <version>1.12</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>2.0.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-archiver</artifactId>
+ <version>1.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-plugin-testing-harness</artifactId>
+ <version>1.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>run-its</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.5</version>
+ <configuration>
+ <debug>true</debug>
+ <projectsDirectory>src/it</projectsDirectory>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ </pomIncludes>
+ <preBuildHookScript>setup</preBuildHookScript>
+ <postBuildHookScript>verify</postBuildHookScript>
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ <settingsFile>src/it/settings.xml</settingsFile>
+ <goals>
+ <goal>clean</goal>
+ <goal>package</goal>
+ </goals>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-01/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-01/pom.xml?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-01/pom.xml (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-01/pom.xml Mon Mar 21 06:10:23 2011
@@ -0,0 +1,47 @@
+<?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>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugin</groupId>
+ <artifactId>maven-acr-plugin-it01</artifactId>
+ <version>1.0</version>
+ <packaging>app-client</packaging>
+
+ <name>Maven ACR Plugin :: Integration test 01</name>
+ <description>Test a simple generation</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-acr-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/java/org/apache/maven/plugin/acr/it/it01/SampleApp.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/java/org/apache/maven/plugin/acr/it/it01/SampleApp.java?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/java/org/apache/maven/plugin/acr/it/it01/SampleApp.java (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/java/org/apache/maven/plugin/acr/it/it01/SampleApp.java Mon Mar 21 06:10:23 2011
@@ -0,0 +1,12 @@
+package org.apache.maven.plugin.acr.it.it01;
+
+
+public class SampleApp
+{
+
+ public String sayHello( String t )
+ {
+ return "Hello " + t;
+ }
+
+}
\ No newline at end of file
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/resources/META-INF/application-client.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/resources/META-INF/application-client.xml?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/resources/META-INF/application-client.xml (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-01/src/main/resources/META-INF/application-client.xml Mon Mar 21 06:10:23 2011
@@ -0,0 +1,15 @@
+<application-client xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd"
+ version="1.4">
+
+ <display-name>A sample app client</display-name>
+
+ <env-entry>
+ <env-entry-name>myKey</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>myValue</env-entry-value>
+ </env-entry>
+
+</application-client>
\ No newline at end of file
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-01/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-01/verify.bsh?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-01/verify.bsh (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-01/verify.bsh Mon Mar 21 06:10:23 2011
@@ -0,0 +1,40 @@
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+import java.util.regex.*;
+
+try
+{
+ File jarFile = new File( basedir, "target/maven-acr-plugin-it01-1.0.jar" );
+ System.out.println( "Checking for existence of " + jarFile );
+ if ( !jarFile.isFile() )
+ {
+ System.out.println( "FAILURE!" );
+ return false;
+ }
+
+ JarFile jar = new JarFile( jarFile );
+
+ String[] includedEntries = {
+ "META-INF/application-client.xml",
+ "org/apache/maven/plugin/acr/it/it01/SampleApp.class",
+ };
+ for ( String included : includedEntries )
+ {
+ System.out.println( "Checking for existence of " + included );
+ if ( jar.getEntry( included ) == null )
+ {
+ System.out.println( "FAILURE!" );
+ return false;
+ }
+ }
+
+ jar.close();
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+return true;
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/pom.xml?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/pom.xml (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/pom.xml Mon Mar 21 06:10:23 2011
@@ -0,0 +1,40 @@
+<?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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.plugin</groupId>
+ <artifactId>maven-acr-plugin-it02</artifactId>
+ <version>1.0</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>maven-acr-plugin-it02-app-client</artifactId>
+ <packaging>app-client</packaging>
+
+ <name>Maven ACR Plugin :: Integration test 02 App client</name>
+ <description>Generates a simple application client to be used as a dependency</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+</project>
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/java/org/apache/maven/plugin/acr/it/it02/SampleApp.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/java/org/apache/maven/plugin/acr/it/it02/SampleApp.java?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/java/org/apache/maven/plugin/acr/it/it02/SampleApp.java (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/java/org/apache/maven/plugin/acr/it/it02/SampleApp.java Mon Mar 21 06:10:23 2011
@@ -0,0 +1,12 @@
+package org.apache.maven.plugin.acr.it.it02;
+
+
+public class SampleApp
+{
+
+ public String sayHello( String t )
+ {
+ return "Hello " + t;
+ }
+
+}
\ No newline at end of file
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/resources/META-INF/application-client.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/resources/META-INF/application-client.xml?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/resources/META-INF/application-client.xml (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-02/app-client/src/main/resources/META-INF/application-client.xml Mon Mar 21 06:10:23 2011
@@ -0,0 +1,15 @@
+<application-client xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd"
+ version="1.4">
+
+ <display-name>A sample app client</display-name>
+
+ <env-entry>
+ <env-entry-name>myKey</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>myValue</env-entry-value>
+ </env-entry>
+
+</application-client>
\ No newline at end of file
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/pom.xml?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/pom.xml (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/pom.xml Mon Mar 21 06:10:23 2011
@@ -0,0 +1,49 @@
+<?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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.plugin</groupId>
+ <artifactId>maven-acr-plugin-it02</artifactId>
+ <version>1.0</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>maven-acr-plugin-it02-bundle</artifactId>
+ <packaging>app-client</packaging>
+
+ <name>Maven ACR Plugin :: Integration test 02 Bundle</name>
+ <description>Generates a simple application client to be used as a dependency</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.plugin</groupId>
+ <artifactId>maven-acr-plugin-it02-app-client</artifactId>
+ <version>1.0</version>
+ <type>app-client</type>
+ </dependency>
+ </dependencies>
+
+</project>
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/java/org/apache/maven/plugin/acr/it/it02/DependencyTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/java/org/apache/maven/plugin/acr/it/it02/DependencyTest.java?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/java/org/apache/maven/plugin/acr/it/it02/DependencyTest.java (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-02/bundle/src/main/java/org/apache/maven/plugin/acr/it/it02/DependencyTest.java Mon Mar 21 06:10:23 2011
@@ -0,0 +1,20 @@
+package org.apache.maven.plugin.acr.it.it02;
+
+
+public class DependencyTest
+{
+
+ private final SampleApp sampleApp;
+
+ public DependencyTest( SampleApp sampleApp )
+ {
+ this.sampleApp = sampleApp;
+ }
+
+
+ public String doIt( String t )
+ {
+ return sampleApp.sayHello( t );
+ }
+
+}
\ No newline at end of file
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-02/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-02/pom.xml?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-02/pom.xml (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-02/pom.xml Mon Mar 21 06:10:23 2011
@@ -0,0 +1,52 @@
+<?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>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugin</groupId>
+ <artifactId>maven-acr-plugin-it02</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+
+ <name>Maven ACR Plugin :: Integration test 02</name>
+ <description>Test that dependencies work</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <modules>
+ <module>app-client</module>
+ <module>bundle</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-acr-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-02/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-02/verify.bsh?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-02/verify.bsh (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-02/verify.bsh Mon Mar 21 06:10:23 2011
@@ -0,0 +1,61 @@
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+import java.util.regex.*;
+
+try
+{
+ File jarFile = new File( basedir, "app-client/target/maven-acr-plugin-it02-app-client-1.0.jar" );
+ System.out.println( "Checking for existence of " + jarFile );
+ if ( !jarFile.isFile() )
+ {
+ System.out.println( "FAILURE!" );
+ return false;
+ }
+
+ JarFile jar = new JarFile( jarFile );
+
+ String[] includedEntries = {
+ "META-INF/application-client.xml",
+ "org/apache/maven/plugin/acr/it/it02/SampleApp.class",
+ };
+ for ( String included : includedEntries )
+ {
+ System.out.println( "Checking for existence of " + included );
+ if ( jar.getEntry( included ) == null )
+ {
+ System.out.println( "FAILURE!" );
+ return false;
+ }
+ }
+
+ jar.close();
+
+ File bundleJarFile = new File( basedir, "bundle/target/maven-acr-plugin-it02-bundle-1.0.jar" );
+ JarFile bundle = new JarFile( bundleJarFile );
+
+
+ String[] includedBundleEntries = {
+ "org/apache/maven/plugin/acr/it/it02/DependencyTest.class",
+ };
+ for ( String included : includedBundleEntries )
+ {
+ System.out.println( "Checking for existence of " + included );
+ if ( bundle.getEntry( included ) == null )
+ {
+ System.out.println( "FAILURE!" );
+ return false;
+ }
+ }
+
+ bundle.close();
+
+
+}
+catch( Throwable t )
+{
+ t.printStackTrace();
+ return false;
+}
+
+return true;
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-03/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-03/pom.xml?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-03/pom.xml (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-03/pom.xml Mon Mar 21 06:10:23 2011
@@ -0,0 +1,47 @@
+<?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>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugin</groupId>
+ <artifactId>maven-acr-plugin-it03</artifactId>
+ <version>1.0</version>
+ <packaging>app-client</packaging>
+
+ <name>Maven ACR Plugin :: Integration test 03</name>
+ <description>Test custom excludes does not add the application-client.xml twice in the archive</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-acr-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-03/src/main/resources/META-INF/application-client.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-03/src/main/resources/META-INF/application-client.xml?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-03/src/main/resources/META-INF/application-client.xml (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-03/src/main/resources/META-INF/application-client.xml Mon Mar 21 06:10:23 2011
@@ -0,0 +1,15 @@
+<application-client xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd"
+ version="1.4">
+
+ <display-name>A sample app client</display-name>
+
+ <env-entry>
+ <env-entry-name>myKey</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>myValue</env-entry-value>
+ </env-entry>
+
+</application-client>
\ No newline at end of file
Copied: maven/plugins/trunk/maven-acr-plugin/src/it/it-03/verify.bsh (from r1081277, maven/plugins/trunk/maven-ejb-plugin/src/it/mejb-34-filtered/verify.bsh)
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-03/verify.bsh?p2=maven/plugins/trunk/maven-acr-plugin/src/it/it-03/verify.bsh&p1=maven/plugins/trunk/maven-ejb-plugin/src/it/mejb-34-filtered/verify.bsh&r1=1081277&r2=1083681&rev=1083681&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/it/mejb-34-filtered/verify.bsh (original)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-03/verify.bsh Mon Mar 21 06:10:23 2011
@@ -1,53 +1,37 @@
import java.io.*;
import java.util.*;
-import java.util.jar.*;
+import java.util.zip.*;
import java.util.regex.*;
-import java.util.zip.ZipEntry;
-import org.codehaus.plexus.util.IOUtil;
-try
+File jarFile = new File( basedir, "target/maven-acr-plugin-it03-1.0.jar" );
+System.out.println( "Checking for existence of " + jarFile );
+if ( !jarFile.isFile() )
{
- File file = new File( basedir, "target/mejb-34-filtered-1.0.jar" );
- System.out.println( "Checking for existence of " + file );
- if ( !file.isFile() )
- {
- System.out.println( "FAILURE! Missing JAR file" );
- return false;
- }
+ throw new FileNotFoundException( "Missing " + jarFile );
+}
+
+ZipInputStream zis = new ZipInputStream( new FileInputStream( jarFile ) );
- JarFile jarFile = new JarFile( file );
+int count = 0;
- ZipEntry zipEntry = jarFile.getEntry( "META-INF/ejb-jar.xml" );
- if ( zipEntry == null )
+while (true)
+{
+ ZipEntry entry = zis.getNextEntry();
+ if ( entry == null )
{
- System.out.println( "FAILURE! Missing META-INF/ejb-jar.xml in the JAR file" );
- return false;
+ break;
}
- else
+ if ( entry.getName().equals( "META-INF/application-client.xml" ) )
{
- InputStream is = jarFile.getInputStream( zipEntry );
- String contents = IOUtil.toString ( is, "UTF-8" );
- int index = contents.indexOf( "myKey" );
- if ( index >= 0 )
- {
- System.out.println( "FAILURE! The key 'myKey' has not been replaced during filtering" );
- return false;
- }
- index = contents.indexOf( "myValue" );
- if ( index < 0 )
- {
- System.out.println( "FAILURE! The value 'myValue' has not been injected during filtering" );
- return false;
- }
- is.close();
+ count++;
}
-
- jarFile.close();
}
-catch( Throwable t )
+
+zis.close();
+
+if ( count != 1 )
{
- t.printStackTrace();
- return false;
+ throw new IllegalStateException( "Wrong number of application-client.xml's in archive: " + count );
}
return true;
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-04/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-04/pom.xml?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-04/pom.xml (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-04/pom.xml Mon Mar 21 06:10:23 2011
@@ -0,0 +1,51 @@
+<?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>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugin</groupId>
+ <artifactId>maven-acr-plugin-it04</artifactId>
+ <version>1.0</version>
+ <packaging>app-client</packaging>
+
+ <name>Maven ACR Plugin :: Integration test 04</name>
+ <description>Test filtering</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <it04.key.value>it04-success</it04.key.value>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-acr-plugin</artifactId>
+ <version>@project.version@</version>
+ <extensions>true</extensions>
+ <configuration>
+ <filterDeploymentDescriptor>true</filterDeploymentDescriptor>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/plugins/trunk/maven-acr-plugin/src/it/it-04/src/main/resources/META-INF/application-client.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-04/src/main/resources/META-INF/application-client.xml?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/it/it-04/src/main/resources/META-INF/application-client.xml (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-04/src/main/resources/META-INF/application-client.xml Mon Mar 21 06:10:23 2011
@@ -0,0 +1,15 @@
+<application-client xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/application-client_1_4.xsd"
+ version="1.4">
+
+ <display-name>A sample app client</display-name>
+
+ <env-entry>
+ <env-entry-name>myKey</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>${it04.key.value}</env-entry-value>
+ </env-entry>
+
+</application-client>
\ No newline at end of file
Copied: maven/plugins/trunk/maven-acr-plugin/src/it/it-04/verify.bsh (from r1081277, maven/plugins/trunk/maven-ejb-plugin/src/it/mejb-34-filtered/verify.bsh)
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/it/it-04/verify.bsh?p2=maven/plugins/trunk/maven-acr-plugin/src/it/it-04/verify.bsh&p1=maven/plugins/trunk/maven-ejb-plugin/src/it/mejb-34-filtered/verify.bsh&r1=1081277&r2=1083681&rev=1083681&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ejb-plugin/src/it/mejb-34-filtered/verify.bsh (original)
+++ maven/plugins/trunk/maven-acr-plugin/src/it/it-04/verify.bsh Mon Mar 21 06:10:23 2011
@@ -7,7 +7,7 @@ import org.codehaus.plexus.util.IOUtil;
try
{
- File file = new File( basedir, "target/mejb-34-filtered-1.0.jar" );
+ File file = new File( basedir, "target/maven-acr-plugin-it04-1.0.jar" );
System.out.println( "Checking for existence of " + file );
if ( !file.isFile() )
{
@@ -17,26 +17,26 @@ try
JarFile jarFile = new JarFile( file );
- ZipEntry zipEntry = jarFile.getEntry( "META-INF/ejb-jar.xml" );
+ ZipEntry zipEntry = jarFile.getEntry( "META-INF/application-client.xml" );
if ( zipEntry == null )
{
- System.out.println( "FAILURE! Missing META-INF/ejb-jar.xml in the JAR file" );
+ System.out.println( "FAILURE! Missing META-INF/application-client.xml in the JAR file" );
return false;
}
else
{
InputStream is = jarFile.getInputStream( zipEntry );
String contents = IOUtil.toString ( is, "UTF-8" );
- int index = contents.indexOf( "myKey" );
+ int index = contents.indexOf( "it04.key.value" );
if ( index >= 0 )
{
- System.out.println( "FAILURE! The key 'myKey' has not been replaced during filtering" );
+ System.out.println( "FAILURE! The key 'it04.key.value' has not been replaced during filtering" );
return false;
}
- index = contents.indexOf( "myValue" );
+ index = contents.indexOf( "it04-success" );
if ( index < 0 )
{
- System.out.println( "FAILURE! The value 'myValue' has not been injected during filtering" );
+ System.out.println( "FAILURE! The value 'it04-success' has not been injected during filtering" );
return false;
}
is.close();
Added: maven/plugins/trunk/maven-acr-plugin/src/main/java/org/apache/maven/plugin/acr/AcrMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/main/java/org/apache/maven/plugin/acr/AcrMojo.java?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/main/java/org/apache/maven/plugin/acr/AcrMojo.java (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/main/java/org/apache/maven/plugin/acr/AcrMojo.java Mon Mar 21 06:10:23 2011
@@ -0,0 +1,295 @@
+package org.apache.maven.plugin.acr;
+
+/*
+ * 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 org.apache.maven.archiver.MavenArchiveConfiguration;
+import org.apache.maven.archiver.MavenArchiver;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.filtering.MavenFileFilter;
+import org.apache.maven.shared.filtering.MavenFilteringException;
+import org.apache.maven.shared.filtering.MavenResourcesExecution;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+import org.codehaus.plexus.archiver.jar.ManifestException;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.xml.XmlStreamReader;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Build a JEE Application Client jar file from the current project.
+ *
+ * @author <a href="pablo@anahata-it.com">Pablo Rodriguez</a>
+ * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
+ * @version $Id:
+ * @goal acr
+ * @requiresDependencyResolution runtime
+ * @threadSafe
+ * @phase package
+ */
+public class AcrMojo
+ extends AbstractMojo
+{
+
+ private static final String APP_CLIENT_XML = "META-INF/application-client.xml";
+
+ // TODO: will null work instead?
+ private static final String[] DEFAULT_INCLUDES = new String[]{ "**/**" };
+
+ private static final String[] DEFAULT_EXCLUDES = new String[]{ APP_CLIENT_XML };
+
+ private static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+ /**
+ * The directory for the generated jar.
+ *
+ * @parameter default-value="${project.build.directory}"
+ * @required
+ * @readonly
+ */
+ private File basedir;
+
+ /**
+ * Directory that resources are copied to during the build.
+ *
+ * @parameter default-value="${project.build.outputDirectory}" expression="${outputDirectory}"
+ */
+ private File outputDirectory;
+
+ /**
+ * The name of the Application client JAR file to generate.
+ *
+ * @parameter default-value="${project.build.finalName}" expression="${jarName}"
+ */
+ private String jarName;
+
+ /**
+ * The files and directories to exclude from the main Application Client jar. Usage:
+ * <p/>
+ * <pre>
+ * <excludes>
+ * <exclude>**/*DevOnly.class</exclude>
+ * </excludes>
+ * </pre>
+ * <br/>Default exclusions: META-INF/application-client.xml,
+ *
+ * @parameter
+ */
+ private List excludes;
+
+ /**
+ * The Maven project.
+ *
+ * @parameter default-value="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * The Jar archiver.
+ *
+ * @component role="org.codehaus.plexus.archiver.Archiver" roleHint="jar"
+ */
+ private JarArchiver jarArchiver;
+
+ /**
+ * The archive configuration to use.
+ * See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven Archiver Reference</a>.
+ *
+ * @parameter
+ */
+ private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
+
+ /**
+ * To escape interpolated value with windows path.
+ * c:\foo\bar will be replaced with c:\\foo\\bar.
+ *
+ * @parameter default-value="false" expression="${acr.escapeBackslashesInFilePath}"
+ */
+ private boolean escapeBackslashesInFilePath;
+
+ /**
+ * An expression preceded with this String won't be interpolated.
+ * \${foo} will be replaced with ${foo}.
+ *
+ * @parameter expression="${car.escapeString}"
+ */
+ protected String escapeString;
+
+ /**
+ * To filter the deployment descriptor.
+ *
+ * @parameter default-value="false" expression="${acr.filterDeploymentDescriptor}"
+ */
+ private boolean filterDeploymentDescriptor;
+
+ /**
+ * Filters (properties files) to include during the interpolation of the deployment descriptor.
+ *
+ * @parameter
+ */
+ private List filters;
+
+ /**
+ * @component role="org.apache.maven.shared.filtering.MavenFileFilter" role-hint="default"
+ * @required
+ */
+ private MavenFileFilter mavenFileFilter;
+
+ /**
+ * @parameter expression="${session}"
+ * @readonly
+ * @required
+ */
+ private MavenSession session;
+
+ /**
+ * Generates the application client jar file
+ *
+ * @todo Add license files in META-INF directory.
+ */
+ public void execute()
+ throws MojoExecutionException
+ {
+ if ( getLog().isInfoEnabled() )
+ {
+ getLog().info( "Building JavaEE Application client: " + jarName );
+ }
+
+ File jarFile = getAppClientJarFile( basedir, jarName );
+
+ MavenArchiver archiver = new MavenArchiver();
+
+ archiver.setArchiver( jarArchiver );
+
+ archiver.setOutputFile( jarFile );
+
+ File deploymentDescriptor = new File( outputDirectory, APP_CLIENT_XML );
+ try
+ {
+ String[] mainJarExcludes = DEFAULT_EXCLUDES;
+
+ if ( excludes != null && !excludes.isEmpty() )
+ {
+ excludes.add( APP_CLIENT_XML );
+ mainJarExcludes = (String[]) excludes.toArray( EMPTY_STRING_ARRAY );
+ }
+
+ if ( !outputDirectory.exists() )
+ {
+ getLog().info(
+ "JAR will only contain the META-INF/application-client.xml as no content was marked for inclusion" );
+ }
+ else
+ {
+ archiver.getArchiver().addDirectory( outputDirectory, DEFAULT_INCLUDES, mainJarExcludes );
+ }
+
+ if ( deploymentDescriptor.exists() )
+ {
+ if ( filterDeploymentDescriptor )
+ {
+ getLog().debug( "Filtering deployment descriptor." );
+ MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution();
+ mavenResourcesExecution.setEscapeString( escapeString );
+ List filterWrappers =
+ mavenFileFilter.getDefaultFilterWrappers( project, filters, escapeBackslashesInFilePath,
+ this.session, mavenResourcesExecution );
+
+ // Create a temporary file that we can copy-and-filter
+ File unfilteredDeploymentDescriptor = new File( outputDirectory, APP_CLIENT_XML + ".unfiltered" );
+ FileUtils.copyFile( deploymentDescriptor, unfilteredDeploymentDescriptor );
+ mavenFileFilter.copyFile( unfilteredDeploymentDescriptor, deploymentDescriptor, true,
+ filterWrappers, getEncoding( unfilteredDeploymentDescriptor ) );
+ // Remove the temporary file
+ FileUtils.forceDelete( unfilteredDeploymentDescriptor );
+ }
+ archiver.getArchiver().addFile( deploymentDescriptor, APP_CLIENT_XML );
+ }
+
+ // create archive
+ archiver.createArchive( project, archive );
+ }
+ catch ( ArchiverException e )
+ {
+ throw new MojoExecutionException(
+ "There was a problem creating the JavaEE Application Client archive: " + e.getMessage(), e );
+ }
+ catch ( ManifestException e )
+ {
+ throw new MojoExecutionException(
+ "There was a problem reading / creating the manifest for the JavaEE Application Client archive: " +
+ e.getMessage(), e );
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException(
+ "There was a I/O problem creating the JavaEE Application Client archive: " + e.getMessage(), e );
+ }
+ catch ( DependencyResolutionRequiredException e )
+ {
+ throw new MojoExecutionException(
+ "There was a problem resolving dependencies while creating the JavaEE Application Client archive: " +
+ e.getMessage(), e );
+ }
+ catch ( MavenFilteringException e )
+ {
+ throw new MojoExecutionException(
+ "There was a problem filtering the deployment descriptor: " + e.getMessage(), e );
+ }
+
+ project.getArtifact().setFile( jarFile );
+
+
+ }
+
+ /**
+ * Returns the App-client Jar file to generate.
+ *
+ * @param basedir the output directory
+ * @param finalName the name of the ear file
+ * @return the Application client JAR file to generate
+ */
+ private static File getAppClientJarFile( File basedir, String finalName )
+ {
+ return new File( basedir, finalName + ".jar" );
+ }
+
+ /**
+ * Get the encoding from an XML-file.
+ *
+ * @param xmlFile the XML-file
+ * @return The encoding of the XML-file, or UTF-8 if it's not specified in the file
+ * @throws IOException if an error occurred while reading the file
+ */
+ private String getEncoding( File xmlFile )
+ throws IOException
+ {
+ XmlStreamReader xmlReader = new XmlStreamReader( xmlFile );
+ return xmlReader.getEncoding();
+ }
+}
Added: maven/plugins/trunk/maven-acr-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-acr-plugin/src/main/resources/META-INF/plexus/components.xml?rev=1083681&view=auto
==============================================================================
--- maven/plugins/trunk/maven-acr-plugin/src/main/resources/META-INF/plexus/components.xml (added)
+++ maven/plugins/trunk/maven-acr-plugin/src/main/resources/META-INF/plexus/components.xml Mon Mar 21 06:10:23 2011
@@ -0,0 +1,59 @@
+<?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.
+ */-->
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+ <role-hint>app-client</role-hint>
+ <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+ <configuration>
+ <type>app-client</type>
+ <extension>jar</extension>
+ <packaging>jar</packaging>
+ <language>java</language>
+ <addedToClasspath>true</addedToClasspath>
+ </configuration>
+ </component>
+ <component>
+ <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+ <role-hint>app-client</role-hint>
+ <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+ <configuration>
+ <lifecycles>
+ <lifecycle>
+ <id>default</id>
+ <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.maven.plugins:maven-acr-plugin:acr</package>
+ <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+ <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+ </phases>
+ </lifecycle>
+ </lifecycles>
+ </configuration>
+ </component>
+ </components>
+</component-set>
\ No newline at end of file
Modified: maven/plugins/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/pom.xml?rev=1083681&r1=1083680&r2=1083681&view=diff
==============================================================================
--- maven/plugins/trunk/pom.xml (original)
+++ maven/plugins/trunk/pom.xml Mon Mar 21 06:10:23 2011
@@ -37,6 +37,7 @@ under the License.
<modules>
<module>maven-plugins</module>
+ <module>maven-acr-plugin</module>
<module>maven-ant-plugin</module>
<module>maven-antrun-plugin</module>
Re: svn commit: r1083681 - in /maven/plugins/trunk: ./ maven-acr-plugin/
maven-acr-plugin/src/ maven-acr-plugin/src/it/ maven-acr-plugin/src/it/it-01/
maven-acr-plugin/src/it/it-01/src/ maven-acr-plugin/src/it/it-01/src/main/
maven-acr-plugin/src/it/it-01/...
Posted by Benjamin Bentmann <be...@udo.edu>.
Hi Stephane,
> Author: snicoll
> Date: Mon Mar 21 06:10:23 2011
> New Revision: 1083681
>
> URL: http://svn.apache.org/viewvc?rev=1083681&view=rev
> Log:
> MACR-1: Initial version of the plugin
>
> Added:
> maven/plugins/trunk/maven-acr-plugin/ (with props)
> maven/plugins/trunk/maven-acr-plugin/pom.xml
Please check your svn client config, all the newly added files miss svn
properties, see [0].
> +<component>
> +<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
> +<role-hint>app-client</role-hint>
> +<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
> +<configuration>
> +<type>app-client</type>
> +<extension>jar</extension>
> +<packaging>jar</packaging>
If this artifact handler is supposed to be used for a project using
<packaging>app-client</packaging>, I suggest to change the handler's
packaging field to match its role-hint as otherwise MNG-4654/-4730 kick in.
> +<component>
> +<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
> +<role-hint>app-client</role-hint>
> +<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
> +<configuration>
> +<lifecycles>
> +<lifecycle>
> +<id>default</id>
> +<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.maven.plugins:maven-acr-plugin:acr</package>
> +<install>org.apache.maven.plugins:maven-install-plugin:install</install>
> +<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
For the sake of reproducible builds, the lifecycle mapping should
include default versions of the plugins, cf. [1]
Benjamin
[0] http://maven.apache.org/developers/committer-environment.html
[1]
http://svn.apache.org/repos/asf/maven/maven-3/trunk/maven-core/src/main/resources/META-INF/plexus/artifact-handlers.xml
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org