You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kr...@apache.org on 2014/10/15 22:27:54 UTC

svn commit: r1632173 - in /maven/plugins/trunk/maven-assembly-plugin/src: it/projects/basic-features/add-classpath/ main/java/org/apache/maven/plugin/assembly/mojos/

Author: krosenvold
Date: Wed Oct 15 20:27:54 2014
New Revision: 1632173

URL: http://svn.apache.org/r1632173
Log:
[MASSEMBLY-576] Manifest classpath not added for maven 3.x

Added:
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/assembly.xml
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/invoker.properties
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/pom.xml
    maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/verify.bsh
Modified:
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/SingleAssemblyMojo.java

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/assembly.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/assembly.xml?rev=1632173&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/assembly.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/assembly.xml Wed Oct 15 20:27:54 2014
@@ -0,0 +1,21 @@
+<assembly>
+  <id>full</id>
+  <formats>
+    <format>jar</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <dependencySets>
+    <dependencySet>
+      <unpack>false</unpack>
+      <scope>runtime</scope>
+      <useProjectArtifact>true</useProjectArtifact>
+      <outputDirectory>lib/</outputDirectory>
+    </dependencySet>
+  </dependencySets>
+  <fileSets>
+    <fileSet>
+      <directory>${project.build.outputDirectory}</directory>
+      <outputDirectory>/</outputDirectory>
+    </fileSet>
+  </fileSets>
+</assembly>
\ No newline at end of file

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/invoker.properties?rev=1632173&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/invoker.properties (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/invoker.properties Wed Oct 15 20:27:54 2014
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals=clean org.apache.maven.plugins:maven-assembly-plugin:${testVersion}:single

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/pom.xml?rev=1632173&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/pom.xml (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/pom.xml Wed Oct 15 20:27:54 2014
@@ -0,0 +1,63 @@
+<?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>
+  <parent>
+    <groupId>org.apache.maven.plugin.assembly.test</groupId>
+    <artifactId>it-project-parent</artifactId>
+    <version>1</version>
+  </parent>
+  
+  <groupId>org.test</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+  
+  <name>Test</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.3</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <configuration>
+          <descriptors>
+            <descriptor>assembly.xml</descriptor>
+          </descriptors>
+          <archive>
+            <manifest>
+              <mainClass>com.example.Main</mainClass>
+              <addClasspath>true</addClasspath>
+              <classpathPrefix>lib/</classpathPrefix>
+            </manifest>
+          </archive>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/verify.bsh?rev=1632173&view=auto
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/verify.bsh (added)
+++ maven/plugins/trunk/maven-assembly-plugin/src/it/projects/basic-features/add-classpath/verify.bsh Wed Oct 15 20:27:54 2014
@@ -0,0 +1,39 @@
+/*
+ * 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.jar.*;
+import java.util.*;
+import java.net.*;
+
+File file = new File( basedir, "target/test-1.0-full.jar" );
+
+System.out.println( "file: " + file + " exists? " + file.exists() );
+
+JarFile jarFile = new JarFile( file );
+
+Manifest mf = jarFile.getManifest();
+
+Attributes attrs = mf.getMainAttributes();
+
+String classPath = (String) attrs.get( Attributes.Name.CLASS_PATH );
+
+System.out.println( "Got Main-Class: " + mainClass );
+
+return  classPath.contains("plexus-utils");

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/SingleAssemblyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/SingleAssemblyMojo.java?rev=1632173&r1=1632172&r2=1632173&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/SingleAssemblyMojo.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/mojos/SingleAssemblyMojo.java Wed Oct 15 20:27:54 2014
@@ -21,6 +21,7 @@ package org.apache.maven.plugin.assembly
 
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
 
 /**
@@ -32,7 +33,7 @@ import org.apache.maven.project.MavenPro
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  * @version $Id$
  */
-@Mojo( name = "single", inheritByDefault = false, threadSafe = true )
+@Mojo( name = "single", inheritByDefault = false, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true )
 public class SingleAssemblyMojo
     extends AbstractAssemblyMojo
 {