Author: gboue
Date: Tue Aug 16 19:16:32 2016
New Revision: 1756544
URL: http://svn.apache.org/viewvc?rev=1756544&view=rev
Log:
[MDEP-537] Goal purge-local-repository requires a Maven project, even with
manualIncludes
The goal purge-local-repository does not require a Maven project to be
executed, since it can be configured to remove dependencies given manually.
Added:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/invoker.properties
(with props)
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/setup.bsh
(with props)
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/test.properties
(with props)
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/verify.bsh
(with props)
Modified:
maven/plugins/trunk/maven-dependency-plugin/pom.xml
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
Modified: maven/plugins/trunk/maven-dependency-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/pom.xml?rev=1756544&r1=1756543&r2=1756544&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-dependency-plugin/pom.xml Tue Aug 16 19:16:32 2016
@@ -367,6 +367,10 @@ under the License.
<!-- verbose was using Maven2 code, removed with MDEP-494,
requires MSHARED-339 to be fixed first -->
<pomExclude>tree-verbose/pom.xml</pomExclude>
</pomExcludes>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ <pomInclude>purge-local-repository-without-pom</pomInclude>
+ </pomIncludes>
<!-- for mrm -->
<settingsFile>src/it/mrm/settings.xml</settingsFile>
<filterProperties>
Added:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/invoker.properties
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/invoker.properties?rev=1756544&view=auto
==============================================================================
---
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/invoker.properties
(added)
+++
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/invoker.properties
Tue Aug 16 19:16:32 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 =
${project.groupId}:${project.artifactId}:${project.version}:purge-local-repository
Propchange:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/invoker.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/invoker.properties
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/setup.bsh
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/setup.bsh?rev=1756544&view=auto
==============================================================================
---
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/setup.bsh
(added)
+++
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/setup.bsh
Tue Aug 16 19:16:32 2016
@@ -0,0 +1,29 @@
+/*
+ * 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.*;
+
+File purgedJar = new File( localRepositoryPath,
"org/apache/maven/its/dependency/purged-without-pom/1.0/purged-without-pom-1.0.jar"
);
+
+purgedJar.getParentFile().mkdirs();
+purgedJar.createNewFile();
+
+System.out.println( "Created dummy JAR " + purgedJar );
+
+return true;
Propchange:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/setup.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/setup.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/test.properties
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/test.properties?rev=1756544&view=auto
==============================================================================
---
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/test.properties
(added)
+++
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/test.properties
Tue Aug 16 19:16:32 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.
+
+manualInclude = org.apache.maven.its.dependency:purged-without-pom
Propchange:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/test.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/test.properties
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/verify.bsh
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/verify.bsh?rev=1756544&view=auto
==============================================================================
---
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/verify.bsh
(added)
+++
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/verify.bsh
Tue Aug 16 19:16:32 2016
@@ -0,0 +1,31 @@
+/*
+ * 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.*;
+
+File purgedJar = new File( localRepositoryPath,
"org/apache/maven/its/dependency/purged-without-pom/1.0/purged-without-pom-1.0.jar"
);
+
+System.out.println( "Checking for absence of dummy JAR " + purgedJar );
+
+if ( purgedJar.exists() )
+{
+ throw new Exception( "JAR was not purged: " + purgedJar );
+}
+
+return true;
Propchange:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/verify.bsh
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-dependency-plugin/src/it/projects/purge-local-repository-without-pom/verify.bsh
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified:
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java?rev=1756544&r1=1756543&r2=1756544&view=diff
==============================================================================
---
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
(original)
+++
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
Tue Aug 16 19:16:32 2016
@@ -59,13 +59,14 @@ import org.codehaus.plexus.util.FileUtil
import org.codehaus.plexus.util.StringUtils;
/**
- * Remove the project dependencies from the local repository, and optionally
re-resolve them.
+ * When run on a project, remove the project dependencies from the local
repository, and optionally re-resolve them.
+ * Outside of a project, remove the manually given dependencies.
*
* @author jdcasey
* @version $Id$
* @since 2.0
*/
-@Mojo( name = "purge-local-repository", threadSafe = true )
+@Mojo( name = "purge-local-repository", threadSafe = true, requiresProject =
false )
public class PurgeLocalRepositoryMojo
extends AbstractMojo
{