Author: olamy
Date: Thu Dec 20 16:28:00 2007
New Revision: 606074

URL: http://svn.apache.org/viewvc?rev=606074&view=rev
Log:
[MJAR-70] add an it test which test if the jar is not created again

Added:
    maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/
    maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/pom.xml
      - copied, changed from r605715, 
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/pom.xml
    maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/src/
      - copied from r605715, 
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/src/
    
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/verify.bsh   
(with props)
Modified:
    maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/pom.xml
    
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/src/main/java/myproject/HelloWorld.java
    
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/src/main/java/myproject/HelloWorld.java

Modified: maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/pom.xml?rev=606074&r1=606073&r2=606074&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/pom.xml (original)
+++ maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/pom.xml Thu Dec 20 
16:28:00 2007
@@ -1,4 +1,22 @@
 <?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>org.apache.maven.plugins</groupId>

Modified: 
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/src/main/java/myproject/HelloWorld.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/src/main/java/myproject/HelloWorld.java?rev=606074&r1=606073&r2=606074&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/src/main/java/myproject/HelloWorld.java
 (original)
+++ 
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/src/main/java/myproject/HelloWorld.java
 Thu Dec 20 16:28:00 2007
@@ -1,16 +1,36 @@
 package myproject;
 
+/*
+ * 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.
+ */
+
 /**
  * The classic Hello World App.
  */
 public class HelloWorld {
 
   /**
-   * Main method.
-   *
-   * @param args Not used
-   */
-  public static void main(String[] args) {
-    System.out.println("Hi!");
-  } 
+     * Main method.
+     *
+     * @param args Not used
+     */
+    public static void main( String[] args )
+    {
+        System.out.println( "Hi!" );
+    } 
 }

Copied: 
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/pom.xml (from 
r605715, maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/pom.xml)
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/pom.xml?p2=maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/pom.xml&p1=maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/pom.xml&r1=605715&r2=606074&rev=606074&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-60/pom.xml (original)
+++ maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/pom.xml 
Thu Dec 20 16:28:00 2007
@@ -1,9 +1,27 @@
 <?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>org.apache.maven.plugins</groupId>
-  <artifactId>MJAR-60</artifactId>
-  <name>MJAR-60</name>
+  <artifactId>MJAR-70-no-recreation</artifactId>
+  <name>MJAR-70-no-recreation</name>
   <packaging>jar</packaging>
   <version>1.0-SNAPSHOT</version>
 
@@ -14,16 +32,6 @@
         <artifactId>maven-jar-plugin</artifactId>
         <version>@pom.version@</version>
         <configuration>
-          <archive>
-            <manifest>
-              <mainClass>myproject.HelloWorld</mainClass>
-              <addClasspath>true</addClasspath>
-              <classpathPrefix>lib</classpathPrefix>
-            </manifest>
-            <manifestEntries>
-              <Class-Path>config/</Class-Path>
-            </manifestEntries>
-          </archive>
         </configuration>
       </plugin>
     </plugins>

Modified: 
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/src/main/java/myproject/HelloWorld.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/src/main/java/myproject/HelloWorld.java?rev=606074&r1=605715&r2=606074&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/src/main/java/myproject/HelloWorld.java
 (original)
+++ 
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/src/main/java/myproject/HelloWorld.java
 Thu Dec 20 16:28:00 2007
@@ -1,16 +1,36 @@
 package myproject;
 
+/*
+ * 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.
+ */
+
 /**
  * The classic Hello World App.
  */
 public class HelloWorld {
 
   /**
-   * Main method.
-   *
-   * @param args Not used
-   */
-  public static void main(String[] args) {
-    System.out.println("Hi!");
-  } 
+     * Main method.
+     *
+     * @param args Not used
+     */
+    public static void main( String[] args )
+    {
+        System.out.println( "Hi!" );
+    } 
 }

Added: 
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/verify.bsh?rev=606074&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/verify.bsh 
(added)
+++ 
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/verify.bsh 
Thu Dec 20 16:28:00 2007
@@ -0,0 +1,75 @@
+
+/*
+ * 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.*;
+import org.codehaus.plexus.util.cli.*;
+
+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-70-no-recreation-1.0-SNAPSHOT.jar" );
+    if ( !artifact.exists() || artifact.isDirectory() )
+    {
+        System.err.println( "artifact file is missing or a directory." );
+        return false;
+    }   
+    
+    long lastModified = artifact.lastModified();
+    
+    Commandline commandline = new Commandline();
+    commandline.setExecutable( "mvn" );
+    commandline.setWorkingDirectory( basedir );
+    commandline.createArg().setLine( "-f interpolated-pom.xml package" );     
+    CommandLineUtils.StringStreamConsumer consumer = new 
CommandLineUtils.StringStreamConsumer();
+    CommandLineUtils.executeCommandLine( commandline, consumer, consumer );
+    
+    System.out.println( consumer.getOutput() );
+       artifact = new File ( target, "MJAR-70-no-recreation-1.0-SNAPSHOT.jar" 
);     
+       if ( !artifact.exists() || artifact.isDirectory() )
+    {
+        System.err.println( "artifact file is missing or a directory." );
+        return false;
+    }
+    if ( lastModified != artifact.lastModified() )
+    {
+        System.err.println( "lastModified != artifact.lastModified() jar has 
been recreated" );
+        return false;    
+    }
+
+    
+}
+catch( Throwable e )
+{
+    e.printStackTrace();
+    result = false;
+}
+
+return result;

Propchange: 
maven/plugins/trunk/maven-jar-plugin/src/it/MJAR-70-no-recreation/verify.bsh
------------------------------------------------------------------------------
    svn:executable = *


Reply via email to