You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2012/06/29 17:48:40 UTC

svn commit: r1355452 - in /maven/plugins/trunk/maven-source-plugin/src: it/test-jar-generated/ it/test-jar-generated/src/ it/test-jar-generated/src/main/ it/test-jar-generated/src/main/java/ it/test-jar-generated/src/main/resources/ it/test-jar-generat...

Author: olamy
Date: Fri Jun 29 15:48:38 2012
New Revision: 1355452

URL: http://svn.apache.org/viewvc?rev=1355452&view=rev
Log:
[MSOURCES-23] test-jar misses sources from "generate-test-sources" phase

Added:
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/invoker.properties   (with props)
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/pom.xml   (with props)
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/java/
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/java/MyClass.java   (with props)
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/resources/
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/resources/main.properties   (with props)
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/java/
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/java/MyTest.java   (with props)
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/resources/
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/resources/test.properties   (with props)
    maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/verify.bsh   (with props)
    maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/TestSourceGeneratedJarMojo.java   (with props)

Added: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/invoker.properties?rev=1355452&view=auto
==============================================================================
--- maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/invoker.properties (added)
+++ maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/invoker.properties Fri Jun 29 15:48:38 2012
@@ -0,0 +1 @@
+invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:generated-test-jar

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/pom.xml?rev=1355452&view=auto
==============================================================================
--- maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/pom.xml (added)
+++ maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/pom.xml Fri Jun 29 15:48:38 2012
@@ -0,0 +1,80 @@
+<?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>test</groupId>
+  <artifactId>test-jar</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <name>Test for test-jar</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
+        <version>@pom.version@</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.3</version>
+        <executions>
+          <execution>
+            <id>generated-sources</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <touch file="target/generated-sources/ant/generated.properties" mkdirs="true"/>
+              </tasks>
+              <testSourceRoot>target/generated-sources/ant</testSourceRoot>
+            </configuration>
+          </execution>
+          <execution>
+            <id>generate-test-sources</id>
+            <phase>generate-test-sources</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <touch file="target/generated-sources/ant/generate-test-sources.properties" mkdirs="true"/>
+              </tasks>
+              <testSourceRoot>target/generated-sources/ant</testSourceRoot>
+            </configuration>
+          </execution>
+
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/java/MyClass.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/java/MyClass.java?rev=1355452&view=auto
==============================================================================
--- maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/java/MyClass.java (added)
+++ maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/java/MyClass.java Fri Jun 29 15:48:38 2012
@@ -0,0 +1,4 @@
+public class MyClass
+{
+
+}

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/java/MyClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/java/MyClass.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/resources/main.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/resources/main.properties?rev=1355452&view=auto
==============================================================================
    (empty)

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/resources/main.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/main/resources/main.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/java/MyTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/java/MyTest.java?rev=1355452&view=auto
==============================================================================
--- maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/java/MyTest.java (added)
+++ maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/java/MyTest.java Fri Jun 29 15:48:38 2012
@@ -0,0 +1,4 @@
+public class MyTest
+{
+
+}

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/java/MyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/java/MyTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/resources/test.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/resources/test.properties?rev=1355452&view=auto
==============================================================================
    (empty)

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/resources/test.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/src/test/resources/test.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/verify.bsh?rev=1355452&view=auto
==============================================================================
--- maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/verify.bsh (added)
+++ maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/verify.bsh Fri Jun 29 15:48:38 2012
@@ -0,0 +1,55 @@
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+import java.util.regex.*;
+
+try
+{
+    File jarFile = new File( basedir, "target/test-jar-1.0-SNAPSHOT-test-sources.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/MANIFEST.MF",
+        "MyTest.java",
+        "test.properties",
+        "generated.properties",
+        "generate-test-sources.properties"
+    };
+    for ( String included : includedEntries )
+    {
+        System.out.println( "Checking for existence of " + included );
+        if ( jar.getEntry( included ) == null )
+        {
+            System.out.println( "FAILURE!" );
+            return false;
+        }
+    }
+
+    String[] excludedEntries = {
+        "MyClass.java",
+        "main.properties",
+    };
+    for ( String excluded : excludedEntries )
+    {
+        System.out.println( "Checking for absence of " + excluded );
+        if ( jar.getEntry( excluded ) != null )
+        {
+            System.out.println( "FAILURE!" );
+            return false;
+        }
+    }
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-source-plugin/src/it/test-jar-generated/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/TestSourceGeneratedJarMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/TestSourceGeneratedJarMojo.java?rev=1355452&view=auto
==============================================================================
--- maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/TestSourceGeneratedJarMojo.java (added)
+++ maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/TestSourceGeneratedJarMojo.java Fri Jun 29 15:48:38 2012
@@ -0,0 +1,36 @@
+package org.apache.maven.plugin.source;
+
+/*
+ * 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.
+ */
+
+/**
+ * This plugin bundles all the test sources into a jar archive.
+ *
+ * @goal generated-test-jar
+ * @phase package
+ * @execute phase="generate-test-sources"
+ * @since 2.2
+ * @threadSafe
+ * 
+ */
+public class TestSourceGeneratedJarMojo
+    extends TestSourceJarNoForkMojo
+{
+    // no op
+}

Propchange: maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/TestSourceGeneratedJarMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-source-plugin/src/main/java/org/apache/maven/plugin/source/TestSourceGeneratedJarMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision