Author: wsmoak Date: Fri Mar 28 20:27:06 2008 New Revision: 642499 URL: http://svn.apache.org/viewvc?rev=642499&view=rev Log: MWAR-131 Added integration test to make sure that the classified artifact is installed in the local repo, and able to be used by another project.
Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/goals.txt maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/pom.xml maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/main/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/main/java/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/main/java/com/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/main/java/com/example/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/main/java/com/example/App.java maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/test/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/test/java/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/test/java/com/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/test/java/com/example/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/test/java/com/example/AppTest.java maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/pom.xml maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/java/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/java/com/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/java/com/example/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/java/com/example/Util.java maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/resources/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/webapp/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/webapp/WEB-INF/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/webapp/WEB-INF/web.xml maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/webapp/index.jsp maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/pom.xml maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/resources/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/webapp/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/webapp/WEB-INF/ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/webapp/WEB-INF/web.xml maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/webapp/index.jsp maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/pom.xml maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/verify.bsh Modified: maven/plugins/trunk/maven-war-plugin/pom.xml Modified: maven/plugins/trunk/maven-war-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/pom.xml?rev=642499&r1=642498&r2=642499&view=diff ============================================================================== --- maven/plugins/trunk/maven-war-plugin/pom.xml (original) +++ maven/plugins/trunk/maven-war-plugin/pom.xml Fri Mar 28 20:27:06 2008 @@ -197,6 +197,9 @@ <pomExcludes> <pomExclude>MWAR-143/war-common/pom.xml</pomExclude> <pomExclude>MWAR-143/war-filter-overlay/pom.xml</pomExclude> + <pomExclude>MWAR-131/mwar131-test/pom.xml</pomExclude> + <pomExclude>MWAR-131/mwar131-webapp/pom.xml</pomExclude> + <pomExclude>MWAR-131/mwar131-webapp2/pom.xml</pomExclude> <pomExclude>**/META-INF/**/pom.xml</pomExclude> </pomExcludes> <postBuildHookScript>verify.bsh</postBuildHookScript> Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/goals.txt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/goals.txt?rev=642499&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/goals.txt (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/goals.txt Fri Mar 28 20:27:06 2008 @@ -0,0 +1 @@ +clean install \ No newline at end of file Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/pom.xml?rev=642499&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/pom.xml (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/pom.xml Fri Mar 28 20:27:06 2008 @@ -0,0 +1,32 @@ +<?xml version="1.0"?><project> + <parent> + <artifactId>mwar131</artifactId> + <groupId>com.example</groupId> + <version>1.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>com.example</groupId> + <artifactId>mwar131-test</artifactId> + <name>Maven Quick Start Archetype</name> + + <description> + Example project that expects the attached jar from mwar131-webapp to be on the compile and test classpath. + </description> + + <version>1.0-SNAPSHOT</version> + <url>http://maven.apache.org</url> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.example</groupId> + <artifactId>mwar131-webapp</artifactId> + <version>1.0-SNAPSHOT</version> + <classifier>classes</classifier> + </dependency> + </dependencies> +</project> \ No newline at end of file Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/main/java/com/example/App.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/main/java/com/example/App.java?rev=642499&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/main/java/com/example/App.java (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/main/java/com/example/App.java Fri Mar 28 20:27:06 2008 @@ -0,0 +1,13 @@ +package com.example; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World is " + Util.isPresent() ); + } +} Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/test/java/com/example/AppTest.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/test/java/com/example/AppTest.java?rev=642499&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/test/java/com/example/AppTest.java (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-test/src/test/java/com/example/AppTest.java Fri Mar 28 20:27:06 2008 @@ -0,0 +1,43 @@ +package com.example; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } + + public void testUtil() + { + assertTrue( Util.isPresent() ); + } +} Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/pom.xml?rev=642499&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/pom.xml (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/pom.xml Fri Mar 28 20:27:06 2008 @@ -0,0 +1,42 @@ +<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> + <parent> + <groupId>com.example</groupId> + <artifactId>mwar131</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + <artifactId>mwar131-webapp</artifactId> + <packaging>war</packaging> + <name>MWAR-131 Webapp</name> + + <description>Web application with classes that get installed as an + attached artifact with a classifier (mwar131-webapp-1.0-SNAPSHOT-classes.jar)</description> + + <url>http://maven.apache.org</url> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.struts</groupId> + <artifactId>struts-core</artifactId> + <version>1.3.9</version> + </dependency> + </dependencies> + <build> + <finalName>mwar131-webapp</finalName> + <plugins> + <plugin> + <artifactId>maven-war-plugin</artifactId> + <version>2.1-alpha-2-SNAPSHOT</version> + <configuration> + <attachClasses>true</attachClasses> + </configuration> + </plugin> + </plugins> + </build> +</project> Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/java/com/example/Util.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/java/com/example/Util.java?rev=642499&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/java/com/example/Util.java (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/java/com/example/Util.java Fri Mar 28 20:27:06 2008 @@ -0,0 +1,9 @@ +package com.example; + +public class Util +{ + public static boolean isPresent() + { + return true; + } +} Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/webapp/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/webapp/WEB-INF/web.xml?rev=642499&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/webapp/WEB-INF/web.xml (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/webapp/WEB-INF/web.xml Fri Mar 28 20:27:06 2008 @@ -0,0 +1,7 @@ +<!DOCTYPE web-app PUBLIC + "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" + "http://java.sun.com/dtd/web-app_2_3.dtd" > + +<web-app> + <display-name>Archetype Created Web Application</display-name> +</web-app> Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/webapp/index.jsp URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/webapp/index.jsp?rev=642499&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/webapp/index.jsp (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp/src/main/webapp/index.jsp Fri Mar 28 20:27:06 2008 @@ -0,0 +1,5 @@ +<html> +<body> +<h2>Hello World!</h2> +</body> +</html> Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/pom.xml?rev=642499&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/pom.xml (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/pom.xml Fri Mar 28 20:27:06 2008 @@ -0,0 +1,37 @@ +<?xml version="1.0"?><project> + <parent> + <artifactId>mwar131</artifactId> + <groupId>com.example</groupId> + <version>1.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <groupId>com.example</groupId> + <artifactId>mwar131-webapp2</artifactId> + <packaging>war</packaging> + <name>Maven Webapp Archetype</name> + + <description> + Webapp that declares the attached jar from mwar131-webapp as a dependency, which should show up in WEB-INF/lib + along with its transitive dependencies. + </description> + + <version>1.0-SNAPSHOT</version> + <url>http://maven.apache.org</url> + <build> + <finalName>${project.artifactId}</finalName> + </build> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.example</groupId> + <artifactId>mwar131-webapp</artifactId> + <version>1.0-SNAPSHOT</version> + <classifier>classes</classifier> + </dependency> + </dependencies> +</project> \ No newline at end of file Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/webapp/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/webapp/WEB-INF/web.xml?rev=642499&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/webapp/WEB-INF/web.xml (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/webapp/WEB-INF/web.xml Fri Mar 28 20:27:06 2008 @@ -0,0 +1,7 @@ +<!DOCTYPE web-app PUBLIC + "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" + "http://java.sun.com/dtd/web-app_2_3.dtd" > + +<web-app> + <display-name>Archetype Created Web Application</display-name> +</web-app> Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/webapp/index.jsp URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/webapp/index.jsp?rev=642499&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/webapp/index.jsp (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/mwar131-webapp2/src/main/webapp/index.jsp Fri Mar 28 20:27:06 2008 @@ -0,0 +1,5 @@ +<html> +<body> +<h2>Hello World!</h2> +</body> +</html> Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/pom.xml?rev=642499&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/pom.xml (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/pom.xml Fri Mar 28 20:27:06 2008 @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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>com.example</groupId> + <artifactId>mwar131</artifactId> + <packaging>pom</packaging> + <version>1.0-SNAPSHOT</version> + <name>MWAR-131 Integration Test</name> + <url>http://maven.apache.org</url> + <modules> + <module>mwar131-webapp</module> + <module>mwar131-test</module> + <module>mwar131-webapp2</module> + </modules> +</project> \ No newline at end of file Added: maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/verify.bsh URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/verify.bsh?rev=642499&view=auto ============================================================================== --- maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/verify.bsh (added) +++ maven/plugins/trunk/maven-war-plugin/src/it/MWAR-131/verify.bsh Fri Mar 28 20:27:06 2008 @@ -0,0 +1,77 @@ + +/* + * 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 org.codehaus.plexus.util.*; + +boolean result = true; + +try +{ + + // Make sure the -classes jar from the first webapp is installed into the local repo + File localRepoClassesJar = new File( basedir, + "../../../target/local-repo/com/example/mwar131-webapp/1.0-SNAPSHOT/mwar131-webapp-1.0-SNAPSHOT-classes.jar"); + + if ( !localRepoClassesJar.exists() || localRepoClassesJar.isDirectory() ) + { + System.err.println( "The -classes jar file is missing or is a directory." ); + return false; + } + + // Make sure the -classes jar is included in WEB-INF/lib of the second webapp + File classesJar = new File( basedir, + "mwar131-webapp2/target/mwar131-webapp2/WEB-INF/lib/mwar131-webapp-1.0-SNAPSHOT-classes.jar"); + + if ( !classesJar.exists() || classesJar.isDirectory() ) + { + System.err.println( "The -classes jar file is missing or is a directory." ); + return false; + } + + // Make sure dependencies of the -classes jar are included in WEB-INF/lib of the second webapp + File strutsJar = new File( basedir, + "mwar131-webapp2/target/mwar131-webapp2/WEB-INF/lib/struts-core-1.3.9.jar"); + + if ( !strutsJar.exists() || strutsJar.isDirectory() ) + { + System.err.println( "The Struts 1.3.9 jar file is missing or is a directory." ); + return false; + } + + // Make sure transitive dependencies of the -classes jar are included in WEB-INF/lib of the second webapp + File digesterJar = new File( basedir, + "mwar131-webapp2/target/mwar131-webapp2/WEB-INF/lib/commons-digester-1.8.jar"); + + if ( !digesterJar.exists() || digesterJar.isDirectory() ) + { + System.err.println( "The Commons Digester 1.8 jar file is missing or is a directory." ); + return false; + } + +} +catch( Throwable e ) +{ + e.printStackTrace(); + result = false; +} + +return result; +