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 2007/12/11 00:32:03 UTC

svn commit: r603098 - in /maven/plugins/trunk/maven-jar-plugin/src/it: mjar-71-01/ mjar-71-01/src/ mjar-71-01/src/main/ mjar-71-01/src/main/java/ mjar-71-01/src/main/java/foo/ mjar-71-01/src/main/java/foo/project003/ mjar-71-01/src/main/resources/ mjar...

Author: olamy
Date: Mon Dec 10 15:32:02 2007
New Revision: 603098

URL: http://svn.apache.org/viewvc?rev=603098&view=rev
Log:
[MJAR-71] add the its

Added:
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/pom.xml   (with props)
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/java/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/java/foo/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/java/foo/project003/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/java/foo/project003/App.java   (with props)
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/resources/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/resources/META-INF/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/resources/META-INF/MANIFEST.MF
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/verify.bsh
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/pom.xml   (with props)
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/java/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/java/foo/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/java/foo/project003/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/java/foo/project003/App.java   (with props)
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/resources/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/resources/META-INF/
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/resources/META-INF/MANIFEST.MF
    maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/verify.bsh

Added: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/pom.xml?rev=603098&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/pom.xml (added)
+++ maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/pom.xml Mon Dec 10 15:32:02 2007
@@ -0,0 +1,26 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  
+  <groupId>org.apache.maven.plugins.jar.it</groupId>
+  <artifactId>mjar-71</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0</version>
+  <name>it-mjar-71</name>
+  <url>http://maven.apache.org</url>
+  <description>Test that the default manifest is added by default if found under target/classes. Can also be overriden.</description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <useDefaultManifestFile>true</useDefaultManifestFile>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = LF

Propchange: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/java/foo/project003/App.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/java/foo/project003/App.java?rev=603098&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/java/foo/project003/App.java (added)
+++ maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/java/foo/project003/App.java Mon Dec 10 15:32:02 2007
@@ -0,0 +1,32 @@
+package foo.project003;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}

Propchange: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/java/foo/project003/App.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Propchange: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/java/foo/project003/App.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Mon Dec 10 15:32:02 2007
@@ -0,0 +1 @@
+URL HeadURL Author LastChangedBy Date LastChangedDate Rev Revision LastChangedRevision Id

Added: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/resources/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/resources/META-INF/MANIFEST.MF?rev=603098&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/resources/META-INF/MANIFEST.MF (added)
+++ maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/src/main/resources/META-INF/MANIFEST.MF Mon Dec 10 15:32:02 2007
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Archiver-Version: foobar-1.23456
+Built-By: jerome
+Build-Jdk: 1.6.0_02-ea
+

Added: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/verify.bsh?rev=603098&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/verify.bsh (added)
+++ maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-01/verify.bsh Mon Dec 10 15:32:02 2007
@@ -0,0 +1,74 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target file is missing or not a directory." );
+        return false;
+    }
+    
+    File artifact = new File ( target, "mjar-71-1.0.jar" );
+    if ( !artifact.exists() || artifact.isDirectory() )
+    {
+        System.err.println( "artifact file " + file + " is missing or a directory." );
+        return false;
+    }    
+    
+    JarFile jar = new JarFile( artifact );
+    Enumeration jarEntries = jar.entries();
+    while ( jarEntries.hasMoreElements() )
+    {
+        JarEntry entry = (JarEntry) jarEntries.nextElement();
+        if ( !entry.isDirectory() )
+        {
+            // Only compare files
+            if ( entry.getName().equals ("META-INF/MANIFEST.MF") )
+            {
+            	String manifest = IOUtil.toString ( jar.getInputStream ( entry ) );
+            	int index = manifest.indexOf ( "Archiver-Version: foobar-1.23456" );
+            	if ( index <= 0 )
+            	{	
+            		System.err.println ( "MANIFEST doens t contain: 'Archiver-Version: foobar-1.23456'" );
+            		return false; 
+            	}
+            	return true;
+            }
+        }
+    }
+    System.err.println ( "MANIFEST.MF not found" );
+    return false;    
+}
+catch( Throwable e )
+{
+    e.printStackTrace();
+    result = false;
+}
+
+return result;

Added: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/pom.xml?rev=603098&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/pom.xml (added)
+++ maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/pom.xml Mon Dec 10 15:32:02 2007
@@ -0,0 +1,23 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  
+  <groupId>org.apache.maven.plugins.jar.it</groupId>
+  <artifactId>mjar-71-02</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0</version>
+  <name>it-mjar-71-02</name>
+  <url>http://maven.apache.org</url>
+  <description>Test that the default manifest is not added when found under target/classes but support is disabled.</description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>@pom.version@</version>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = LF

Propchange: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/java/foo/project003/App.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/java/foo/project003/App.java?rev=603098&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/java/foo/project003/App.java (added)
+++ maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/java/foo/project003/App.java Mon Dec 10 15:32:02 2007
@@ -0,0 +1,32 @@
+package foo.project003;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}

Propchange: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/java/foo/project003/App.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Propchange: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/java/foo/project003/App.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Mon Dec 10 15:32:02 2007
@@ -0,0 +1 @@
+URL HeadURL Author LastChangedBy Date LastChangedDate Rev Revision LastChangedRevision Id

Added: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/resources/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/resources/META-INF/MANIFEST.MF?rev=603098&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/resources/META-INF/MANIFEST.MF (added)
+++ maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/src/main/resources/META-INF/MANIFEST.MF Mon Dec 10 15:32:02 2007
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Archiver-Version: foobar-1.23456
+Built-By: jerome
+Build-Jdk: 1.6.0_02-ea
+

Added: maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/verify.bsh?rev=603098&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/verify.bsh (added)
+++ maven/plugins/trunk/maven-jar-plugin/src/it/mjar-71-02/verify.bsh Mon Dec 10 15:32:02 2007
@@ -0,0 +1,74 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target file is missing or not a directory." );
+        return false;
+    }
+    
+    File artifact = new File ( target, "mjar-71-02-1.0.jar" );
+    if ( !artifact.exists() || artifact.isDirectory() )
+    {
+        System.err.println( "artifact file " + file + " is missing or a directory." );
+        return false;
+    }    
+    
+    JarFile jar = new JarFile( artifact );
+    Enumeration jarEntries = jar.entries();
+    while ( jarEntries.hasMoreElements() )
+    {
+        JarEntry entry = (JarEntry) jarEntries.nextElement();
+        if ( !entry.isDirectory() )
+        {
+            // Only compare files
+            if ( entry.getName().equals ("META-INF/MANIFEST.MF") )
+            {
+            	String manifest = IOUtil.toString ( jar.getInputStream ( entry ) );
+            	int index = manifest.indexOf ( "Archiver-Version: foobar-1.23456" );
+            	if ( index > 0 )
+            	{	
+            		System.err.println ( "MANIFEST contains: 'Archiver-Version: foobar-1.23456', but shouldn't" );
+            		return false; 
+            	}
+            	return true;
+            }
+        }
+    }
+    System.err.println ( "MANIFEST.MF not found" );
+    return false;    
+}
+catch( Throwable e )
+{
+    e.printStackTrace();
+    result = false;
+}
+
+return result;