You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gb...@apache.org on 2016/12/17 20:40:08 UTC
svn commit: r1774803 - in /maven/plugins/trunk/maven-dependency-plugin/src:
it/projects/build-classpath-output-file-and-property/
main/java/org/apache/maven/plugins/dependency/fromDependencies/
Author: gboue
Date: Sat Dec 17 20:40:08 2016
New Revision: 1774803
URL: http://svn.apache.org/viewvc?rev=1774803&view=rev
Log:
[MDEP-482] Can't use both outputProperty and outputFile in build-classpath mojo
Submitted by: Dagan Sandler
Make sure outputFile and outputProperty can both be used at the same time. Applied patch after adding an IT.
Added:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/invoker.properties (with props)
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/pom.xml (with props)
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/test.properties (with props)
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/verify.bsh (with props)
Modified:
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/BuildClasspathMojo.java
Added: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/invoker.properties?rev=1774803&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/invoker.properties (added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/invoker.properties Sat Dec 17 20:40:08 2016
@@ -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 package
Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/invoker.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/invoker.properties
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/pom.xml?rev=1774803&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/pom.xml (added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/pom.xml Sat Dec 17 20:40:08 2016
@@ -0,0 +1,89 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.dependency</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <url>https://issues.apache.org/jira/browse/MDEP-482</url>
+ <description>
+ Test dependency:build-classpath when setting both an output file and an output property
+ </description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.dependency</groupId>
+ <artifactId>get-artifact</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <id>its</id>
+ <goals>
+ <goal>build-classpath</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>1.4.1</version>
+ <executions>
+ <execution>
+ <id>enforce-property</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <rules>
+ <evaluateBeanshell>
+ <!-- Makes sure that the output property was correctly set. -->
+ <condition>
+ "${classpath.property}".equals( "PREFIX/get-artifact-1.0.jar:PREFIX/get-artifact-transitive-1.0.jar" )
+ </condition>
+ </evaluateBeanshell>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/test.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/test.properties?rev=1774803&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/test.properties (added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/test.properties Sat Dec 17 20:40:08 2016
@@ -0,0 +1,22 @@
+# 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.
+
+mdep.outputFile = target/classpath.txt
+mdep.outputProperty = classpath.property
+mdep.fileSeparator = /
+mdep.pathSeparator = :
+mdep.prefix = PREFIX
\ No newline at end of file
Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/test.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/test.properties
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/verify.bsh?rev=1774803&view=auto
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/verify.bsh (added)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/verify.bsh Sat Dec 17 20:40:08 2016
@@ -0,0 +1,35 @@
+/*
+ * 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 org.codehaus.plexus.util.*;
+
+String classpath = FileUtils.fileRead( new File( basedir, "target/classpath.txt" ) );
+String expected = "PREFIX/get-artifact-1.0.jar:PREFIX/get-artifact-transitive-1.0.jar";
+
+if ( !classpath.equals( expected ) )
+{
+ System.out.println( "Actual : " + actual );
+ System.out.println( "Expected: " + expected );
+ throw new Exception( "Unexpected classpath" );
+}
+
+return true;
Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/verify.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-dependency-plugin/src/it/projects/build-classpath-output-file-and-property/verify.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/BuildClasspathMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/BuildClasspathMojo.java?rev=1774803&r1=1774802&r2=1774803&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/BuildClasspathMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/BuildClasspathMojo.java Sat Dec 17 20:40:08 2016
@@ -232,7 +232,8 @@ public class BuildClasspathMojo
getLog().debug( outputProperty + " = " + cpString );
}
}
- else if ( outputFile == null )
+
+ if ( outputFile == null )
{
getLog().info( "Dependencies classpath:\n" + cpString );
}