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 2009/02/22 17:21:06 UTC
svn commit: r746754 - in /maven/plugins/trunk/maven-ear-plugin/src:
main/java/org/apache/maven/plugin/ear/ site/apt/
test/java/org/apache/maven/plugin/ear/it/
test/resources/m2repo/eartest/jar-sample-three-with-deps/
test/resources/m2repo/eartest/jar-s...
Author: snicoll
Date: Sun Feb 22 16:21:05 2009
New Revision: 746754
URL: http://svn.apache.org/viewvc?rev=746754&view=rev
Log:
MEAR-86: Added a way to include libraries in application.xml using a flag
Added:
maven/plugins/trunk/maven-ear-plugin/src/test/resources/m2repo/eartest/jar-sample-three-with-deps/
maven/plugins/trunk/maven-ear-plugin/src/test/resources/m2repo/eartest/jar-sample-three-with-deps/1.0/
maven/plugins/trunk/maven-ear-plugin/src/test/resources/m2repo/eartest/jar-sample-three-with-deps/1.0/jar-sample-three-with-deps-1.0.jar (with props)
maven/plugins/trunk/maven-ear-plugin/src/test/resources/m2repo/eartest/jar-sample-three-with-deps/1.0/jar-sample-three-with-deps-1.0.pom
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-055/
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-055/expected-META-INF/
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-055/expected-META-INF/application.xml
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-055/pom.xml
Modified:
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EjbClientModule.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java
maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JavaModule.java
maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt
maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java
maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-054/pom.xml
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java?rev=746754&r1=746753&r2=746754&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/AbstractEarMojo.java Sun Feb 22 16:21:05 2009
@@ -50,7 +50,7 @@
public static final String VERSION_1_4 = "1.4";
public static final String VERSION_5 = "5";
-
+
public static final String APPLICATION_XML_URI = "META-INF/application.xml";
public static final String META_INF = "META-INF";
@@ -110,6 +110,13 @@
protected String defaultLibBundleDir;
/**
+ * Should libraries be added in application.xml
+ *
+ * @parameter default-value="false"
+ */
+ private Boolean includeLibInApplicationXml = Boolean.FALSE;
+
+ /**
* The file name mapping to use for all dependencies included
* in the EAR file.
*
@@ -214,7 +221,8 @@
if ( !isArtifactRegistered( artifact, allModules ) && !artifact.isOptional() &&
filter.include( artifact ) )
{
- EarModule module = EarModuleFactory.newEarModule( artifact, defaultLibBundleDir );
+ EarModule module = EarModuleFactory.newEarModule( artifact, defaultLibBundleDir,
+ includeLibInApplicationXml );
allModules.add( module );
}
}
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java?rev=746754&r1=746753&r2=746754&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EarModuleFactory.java Sun Feb 22 16:21:05 2009
@@ -54,20 +54,22 @@
* specified {@link Artifact} and the specified
* execution configuration.
*
- * @param artifact the artifact
- * @param defaultLibBundleDir the default bundle dir for {@link JarModule}
+ * @param artifact the artifact
+ * @param defaultLibBundleDir the default bundle dir for {@link JarModule}
+ * @param includeInApplicationXml should {@link JarModule} be included in application Xml
* @return an ear module for this artifact
+ * @throws UnknownArtifactTypeException if the artifact is not handled
*/
- public static EarModule newEarModule( Artifact artifact, String defaultLibBundleDir )
+ public static EarModule newEarModule( Artifact artifact, String defaultLibBundleDir,
+ Boolean includeInApplicationXml )
throws UnknownArtifactTypeException
{
// Get the standard artifact type based on default config and user-defined mapping(s)
- final String artifactType =
- ArtifactTypeMappingService.getInstance().getStandardType( artifact.getType());
+ final String artifactType = ArtifactTypeMappingService.getInstance().getStandardType( artifact.getType() );
if ( "jar".equals( artifactType ) )
{
- return new JarModule( artifact, defaultLibBundleDir );
+ return new JarModule( artifact, defaultLibBundleDir, includeInApplicationXml );
}
else if ( "ejb".equals( artifactType ) )
{
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EjbClientModule.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EjbClientModule.java?rev=746754&r1=746753&r2=746754&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EjbClientModule.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/EjbClientModule.java Sun Feb 22 16:21:05 2009
@@ -40,7 +40,7 @@
public EjbClientModule( Artifact a, String defaultLibBundleDir )
{
- super( a, defaultLibBundleDir );
+ super( a, defaultLibBundleDir, Boolean.FALSE );
}
public String getType()
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java?rev=746754&r1=746753&r2=746754&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JarModule.java Sun Feb 22 16:21:05 2009
@@ -49,10 +49,11 @@
super();
}
- public JarModule( Artifact a, String defaultLibBundleDir )
+ public JarModule( Artifact a, String defaultLibBundleDir, Boolean includeInApplicationXml )
{
super( a );
setLibBundleDir( defaultLibBundleDir );
+ this.includeInApplicationXml = includeInApplicationXml;
}
Modified: maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JavaModule.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JavaModule.java?rev=746754&r1=746753&r2=746754&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JavaModule.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/main/java/org/apache/maven/plugin/ear/JavaModule.java Sun Feb 22 16:21:05 2009
@@ -43,10 +43,10 @@
}
/**
- * @deprecated use {@link org.apache.maven.plugin.ear.JavaModule#JarModule(org.apache.maven.artifact.Artifact,String)}} instead
+ * @deprecated use {@link JarModule} instead
*/
- public JavaModule( Artifact a, String defaultLibBundleDir )
+ public JavaModule( Artifact a, String defaultLibBundleDir, Boolean includeInApplicationXml )
{
- super( a, defaultLibBundleDir );
+ super( a, defaultLibBundleDir, includeInApplicationXml );
}
}
Modified: maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt?rev=746754&r1=746753&r2=746754&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/site/apt/tests.apt Sun Feb 22 16:21:05 2009
@@ -138,4 +138,6 @@
* project-054: builds an EAR with deployment descriptor configuration for Java EE 5 and no application.xml
+ * project-055: builds an EAR with jar dependencies added in application.xml
+
\ No newline at end of file
Modified: maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java?rev=746754&r1=746753&r2=746754&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/test/java/org/apache/maven/plugin/ear/it/EarMojoIT.java Sun Feb 22 16:21:05 2009
@@ -585,4 +585,14 @@
{
doTestProject( "project-054", new String[]{"ejb-sample-one-1.0.jar", "ejb-sample-two-1.0.jar"} );
}
+
+ /**
+ * Builds an EAR with jar dependencies added in application.xml.
+ */
+ public void testProject055()
+ throws Exception
+ {
+ doTestProject( "project-055", new String[]{"jar-sample-one-1.0.jar", "jar-sample-two-1.0.jar",
+ "jar-sample-three-with-deps-1.0.jar"} );
+ }
}
Added: maven/plugins/trunk/maven-ear-plugin/src/test/resources/m2repo/eartest/jar-sample-three-with-deps/1.0/jar-sample-three-with-deps-1.0.jar
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/m2repo/eartest/jar-sample-three-with-deps/1.0/jar-sample-three-with-deps-1.0.jar?rev=746754&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/trunk/maven-ear-plugin/src/test/resources/m2repo/eartest/jar-sample-three-with-deps/1.0/jar-sample-three-with-deps-1.0.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: maven/plugins/trunk/maven-ear-plugin/src/test/resources/m2repo/eartest/jar-sample-three-with-deps/1.0/jar-sample-three-with-deps-1.0.pom
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/m2repo/eartest/jar-sample-three-with-deps/1.0/jar-sample-three-with-deps-1.0.pom?rev=746754&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/test/resources/m2repo/eartest/jar-sample-three-with-deps/1.0/jar-sample-three-with-deps-1.0.pom (added)
+++ maven/plugins/trunk/maven-ear-plugin/src/test/resources/m2repo/eartest/jar-sample-three-with-deps/1.0/jar-sample-three-with-deps-1.0.pom Sun Feb 22 16:21:05 2009
@@ -0,0 +1,36 @@
+<!--
+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>eartest</groupId>
+ <artifactId>jar-sample-three-with-deps</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0</version>
+ <distributionManagement>
+ <status>verified</status>
+ </distributionManagement>
+ <dependencies>
+ <dependency>
+ <groupId>eartest</groupId>
+ <artifactId>jar-sample-two</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+</project>
Modified: maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-054/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-054/pom.xml?rev=746754&r1=746753&r2=746754&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-054/pom.xml (original)
+++ maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-054/pom.xml Sun Feb 22 16:21:05 2009
@@ -45,6 +45,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
+ <version>@project.version@</version>
<configuration>
<version>5</version>
<generateApplicationXml>false</generateApplicationXml>
Added: maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-055/expected-META-INF/application.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-055/expected-META-INF/application.xml?rev=746754&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-055/expected-META-INF/application.xml (added)
+++ maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-055/expected-META-INF/application.xml Sun Feb 22 16:21:05 2009
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE application PUBLIC
+ "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
+ "http://java.sun.com/dtd/application_1_3.dtd">
+<application>
+ <display-name>maven-ear-plugin-test-project-055</display-name>
+ <module>
+ <java>jar-sample-three-with-deps-1.0.jar</java>
+ </module>
+ <module>
+ <java>jar-sample-two-1.0.jar</java>
+ </module>
+ <module>
+ <java>jar-sample-one-1.0.jar</java>
+ </module>
+</application>
\ No newline at end of file
Added: maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-055/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-055/pom.xml?rev=746754&view=auto
==============================================================================
--- maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-055/pom.xml (added)
+++ maven/plugins/trunk/maven-ear-plugin/src/test/resources/projects/project-055/pom.xml Sun Feb 22 16:21:05 2009
@@ -0,0 +1,53 @@
+<?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>ear</groupId>
+ <artifactId>maven-ear-plugin-test-project-055</artifactId>
+ <version>99.0</version>
+ <name>Maven</name>
+ <packaging>ear</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>eartest</groupId>
+ <artifactId>jar-sample-one</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>eartest</groupId>
+ <artifactId>jar-sample-three-with-deps</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <includeLibInApplicationXml>true</includeLibInApplicationXml>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file