You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2019/08/01 00:17:41 UTC
[maven-dependency-plugin] branch master updated (35de661 -> 85428ad)
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git.
from 35de661 improved documentation for tree graph formats support
new 8116432 [MDEP-653] - Additional logging for multi module, manual and re-resolving.
new 85428ad [MDEP-653] simplified default log
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../purge-local-repository-log/invoker.properties | 18 ---------
src/it/projects/purge-local-repository-log/pom.xml | 47 ----------------------
.../purge-local-repository-multi-module/verify.bsh | 37 -----------------
.../verify.groovy | 15 ++++++-
.../purge-local-repository-without-pom/verify.bsh | 31 --------------
.../verify.groovy | 14 ++++++-
src/it/projects/purge-local-repository/verify.bsh | 31 --------------
.../verify.groovy | 14 ++++++-
.../dependency/PurgeLocalRepositoryMojo.java | 46 ++++++++++++++-------
9 files changed, 71 insertions(+), 182 deletions(-)
delete mode 100644 src/it/projects/purge-local-repository-log/invoker.properties
delete mode 100644 src/it/projects/purge-local-repository-log/pom.xml
delete mode 100644 src/it/projects/purge-local-repository-multi-module/verify.bsh
copy src/it/projects/{purge-local-repository-log => purge-local-repository-multi-module}/verify.groovy (68%)
delete mode 100644 src/it/projects/purge-local-repository-without-pom/verify.bsh
copy src/it/projects/{purge-local-repository-log => purge-local-repository-without-pom}/verify.groovy (69%)
delete mode 100644 src/it/projects/purge-local-repository/verify.bsh
rename src/it/projects/{purge-local-repository-log => purge-local-repository}/verify.groovy (68%)
[maven-dependency-plugin] 01/02: [MDEP-653] - Additional logging
for multi module, manual and re-resolving.
Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
commit 81164326c58c3835f69085c2ddc1e8496fecd299
Author: Pim Moerenhout <pi...@gmail.com>
AuthorDate: Sun Jul 28 00:12:22 2019 +0200
[MDEP-653] - Additional logging for multi module, manual and re-resolving.
---
.../purge-local-repository-log/invoker.properties | 18 ---------
src/it/projects/purge-local-repository-log/pom.xml | 47 ----------------------
.../purge-local-repository-multi-module/verify.bsh | 37 -----------------
.../verify.groovy} | 22 +++++-----
.../verify.groovy | 14 ++++++-
.../verify.groovy} | 21 +++++-----
.../dependency/PurgeLocalRepositoryMojo.java | 46 +++++++++++++++------
7 files changed, 70 insertions(+), 135 deletions(-)
diff --git a/src/it/projects/purge-local-repository-log/invoker.properties b/src/it/projects/purge-local-repository-log/invoker.properties
deleted file mode 100644
index 3c1911e..0000000
--- a/src/it/projects/purge-local-repository-log/invoker.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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
diff --git a/src/it/projects/purge-local-repository-log/pom.xml b/src/it/projects/purge-local-repository-log/pom.xml
deleted file mode 100644
index ced92c4..0000000
--- a/src/it/projects/purge-local-repository-log/pom.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?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>purge-local-repository-log</artifactId>
- <version>1.0-SNAPSHOT</version>
-
- <name>Test</name>
- <description>
- Test dependency:purge-local-repository log messages
- </description>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.its.dependency</groupId>
- <artifactId>purge-local-repository</artifactId>
- <version>1.0</version>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/src/it/projects/purge-local-repository-multi-module/verify.bsh b/src/it/projects/purge-local-repository-multi-module/verify.bsh
deleted file mode 100644
index fde1a2b..0000000
--- a/src/it/projects/purge-local-repository-multi-module/verify.bsh
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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;
-
-void checkFilePurged( String artifactId )
-{
- File purgedJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/" + artifactId + "/1.0/" + artifactId + "-1.0.jar" );
-
- System.out.println( "Checking for absence of dummy JAR " + purgedJar );
-
- if ( purgedJar.exists() )
- {
- throw new Exception( "JAR was not purged: " + purgedJar );
- }
-}
-
-checkFilePurged( "purged-a" );
-checkFilePurged( "purged-b" );
-
-return true;
diff --git a/src/it/projects/purge-local-repository/verify.bsh b/src/it/projects/purge-local-repository-multi-module/verify.groovy
similarity index 54%
rename from src/it/projects/purge-local-repository/verify.bsh
rename to src/it/projects/purge-local-repository-multi-module/verify.groovy
index 12bf5e3..c15a4a9 100644
--- a/src/it/projects/purge-local-repository/verify.bsh
+++ b/src/it/projects/purge-local-repository-multi-module/verify.groovy
@@ -17,15 +17,19 @@
* under the License.
*/
-import java.io.*;
-
-File purgedJar = new File( localRepositoryPath, "org/apache/maven/its/dependency/purged/1.0/purged-1.0.jar" );
-
-System.out.println( "Checking for absence of dummy JAR " + purgedJar );
-
-if ( purgedJar.exists() )
+void checkFileAbsence( String path )
{
- throw new Exception( "JAR was not purged: " + purgedJar );
+ File depJar = new File( localRepositoryPath, path );
+ if ( depJar.exists() )
+ {
+ throw new Exception( "Dependency jar was not purged: " + depJar );
+ }
}
-return true;
+checkFileAbsence("purged-a" );
+checkFileAbsence("purged-b" );
+
+String buildLog = new File( basedir, "build.log" ).getText( "UTF-8" );
+assert buildLog.contains( 'Deleting 1 transitive dependency for project org.apache.maven.its.dependency:child1:1.0-SNAPSHOT from ' );
+assert buildLog.contains( 'Deleting 1 transitive dependency for project org.apache.maven.its.dependency:child2:1.0-SNAPSHOT from ' );
+assert buildLog.contains( 'with artifact version resolution fuzziness' );
diff --git a/src/it/projects/purge-local-repository-log/verify.groovy b/src/it/projects/purge-local-repository-without-pom/verify.groovy
similarity index 69%
rename from src/it/projects/purge-local-repository-log/verify.groovy
rename to src/it/projects/purge-local-repository-without-pom/verify.groovy
index 0a09942..409e6bc 100644
--- a/src/it/projects/purge-local-repository-log/verify.groovy
+++ b/src/it/projects/purge-local-repository-without-pom/verify.groovy
@@ -17,6 +17,16 @@
* under the License.
*/
+void checkFileAbsence( String path )
+{
+ File depJar = new File( localRepositoryPath, path );
+ if ( depJar.exists() )
+ {
+ throw new Exception( "Dependency jar was not purged: " + depJar );
+ }
+}
+
+checkFileAbsence( "org/apache/maven/its/dependency/purged-without-pom/1.0/purged-without-pom-1.0.jar" );
+
String buildLog = new File( basedir, "build.log" ).getText( "UTF-8" );
-assert buildLog.contains( 'Deleting 2 projects\' transitive dependencies from' );
-assert buildLog.contains( 'with artifact version resolution fuzziness' );
+assert buildLog.contains( 'Deleting 1 manual dependency from ' );
diff --git a/src/it/projects/purge-local-repository-without-pom/verify.bsh b/src/it/projects/purge-local-repository/verify.groovy
similarity index 56%
rename from src/it/projects/purge-local-repository-without-pom/verify.bsh
rename to src/it/projects/purge-local-repository/verify.groovy
index 2c9b1d4..404ae38 100644
--- a/src/it/projects/purge-local-repository-without-pom/verify.bsh
+++ b/src/it/projects/purge-local-repository/verify.groovy
@@ -17,15 +17,18 @@
* 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() )
+void checkFileAbsence( String path )
{
- throw new Exception( "JAR was not purged: " + purgedJar );
+ File depJar = new File( localRepositoryPath, path );
+ System.out.println( "Checking for absence of dummy JAR " + depJar );
+ if ( depJar.exists() )
+ {
+ throw new Exception( "Dependency jar was not purged: " + depJar );
+ }
}
-return true;
+checkFileAbsence( "org/apache/maven/its/dependency/purged/1.0/purged-1.0.jar" );
+
+String buildLog = new File( basedir, "build.log" ).getText( "UTF-8" );
+assert buildLog.contains( 'Deleting 1 transitive dependency for project org.apache.maven.its.dependency:test:1.0-SNAPSHOT from ' );
+assert buildLog.contains( 'with artifact version resolution fuzziness' );
diff --git a/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java b/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
index a773ced..a628a58 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
@@ -235,7 +235,6 @@ public class PurgeLocalRepositoryMojo
private class DirectDependencyFilter
extends AbstractFilter
{
-
private Artifact projectArtifact;
private List<Dependency> directDependencies;
@@ -379,16 +378,16 @@ public class PurgeLocalRepositoryMojo
if ( resolvedArtifactsToPurge.isEmpty() )
{
- getLog().info( "No artifacts included for purge for project: " + theProject.getId() );
+ getLog().info( "No artifacts included for purge for project: " + getProjectKey( theProject ) );
return;
}
- verbose( "Purging dependencies for project: " + theProject.getId() );
- purgeArtifacts( resolvedArtifactsToPurge );
+ purgeArtifacts( theProject, resolvedArtifactsToPurge );
purgedArtifacts.addAll( resolvedArtifactsToPurge );
if ( reResolve )
{
+ getLog().info( "Re-resolving dependencies" );
ArtifactFilter artifactFilter = dependencyFilter.transform( new ArtifactIncludeFilterTransformer() );
try
{
@@ -422,17 +421,27 @@ public class PurgeLocalRepositoryMojo
private void manualPurge( List<String> theIncludes )
throws MojoExecutionException
{
+ MessageBuilder messageBuilder = MessageUtils.buffer();
+
+ getLog().info( messageBuilder.a( "Deleting " ).strong( theIncludes.size() )
+ .a( " manual " )
+ .a( theIncludes.size() != 1 ? "dependencies" : "dependency" )
+ .a( " from " )
+ .strong( localRepository.getBasedir() )
+ .toString() );
+
for ( String gavPattern : theIncludes )
{
if ( StringUtils.isEmpty( gavPattern ) )
{
- getLog().debug( "Skipping empty gav pattern: " + gavPattern );
+ getLog().debug( "Skipping empty gav pattern" );
continue;
}
String relativePath = gavToPath( gavPattern );
if ( StringUtils.isEmpty( relativePath ) )
{
+ getLog().debug( "Skipping empty relative path for gav pattern: " + gavPattern );
continue;
}
@@ -449,6 +458,10 @@ public class PurgeLocalRepositoryMojo
throw new MojoExecutionException( "Unable to purge directory: " + purgeDir );
}
}
+ else
+ {
+ getLog().debug( "Directory: " + purgeDir + " doesn't exist" );
+ }
}
}
@@ -573,6 +586,8 @@ public class PurgeLocalRepositoryMojo
private Set<Artifact> getFilteredResolvedArtifacts( MavenProject theProject, List<Dependency> dependencies,
TransformableFilter filter )
{
+ verbose( "Resolve dependencies for: " + getProjectKey( theProject ) );
+
try
{
Iterable<ArtifactResult> results =
@@ -590,8 +605,7 @@ public class PurgeLocalRepositoryMojo
}
catch ( DependencyResolverException e )
{
- getLog().info( "Unable to resolve all dependencies for: " + theProject.getGroupId() + ":"
- + theProject.getArtifactId() + ":" + theProject.getVersion()
+ getLog().info( "Unable to resolve all dependencies for: " + getProjectKey( theProject )
+ ". Falling back to non-transitive mode for initial artifact resolution." );
}
@@ -623,14 +637,16 @@ public class PurgeLocalRepositoryMojo
return resolvedArtifacts;
}
- private void purgeArtifacts( Set<Artifact> artifacts )
+ private void purgeArtifacts( MavenProject theProject, Set<Artifact> artifacts )
throws MojoFailureException
{
MessageBuilder messageBuilder = MessageUtils.buffer();
- getLog().info( messageBuilder.a( "Deleting " ).strong( artifacts.size() ).a( " projects' " )
- .strong( actTransitively ? "transitive" : "direct" )
- .a( " dependencies from " ).strong( localRepository.getBasedir() )
+ getLog().info( messageBuilder.a( "Deleting " ).strong( artifacts.size() )
+ .a( " " ).strong( actTransitively ? "transitive" : "direct" )
+ .a( artifacts.size() != 1 ? " dependencies" : " dependency" )
+ .a( " for project " ).strong( getProjectKey( theProject ) )
+ .a( " from " ).strong( localRepository.getBasedir() )
.a( " with artifact " ).strong( resolutionFuzziness ).a( " resolution fuzziness" )
.toString() );
@@ -640,7 +656,7 @@ public class PurgeLocalRepositoryMojo
File deleteTarget = findDeleteTarget( artifact );
- verbose( "Deleting: " + deleteTarget );
+ getLog().info( "Deleting: " + deleteTarget );
if ( deleteTarget.isDirectory() )
{
@@ -668,7 +684,6 @@ public class PurgeLocalRepositoryMojo
private void reResolveArtifacts( MavenProject theProject, Set<Artifact> artifacts, ArtifactFilter filter )
throws ArtifactResolutionException, ArtifactNotFoundException
{
-
// Always need to re-resolve the poms in case they were purged along with the artifact
// because Maven 2 will not automatically re-resolve them when resolving the artifact
for ( Artifact artifact : artifacts )
@@ -751,6 +766,11 @@ public class PurgeLocalRepositoryMojo
}
}
+ private String getProjectKey( MavenProject project )
+ {
+ return project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
+ }
+
/**
* @return {@link #skip}
*/
[maven-dependency-plugin] 02/02: [MDEP-653] simplified default log
Posted by hb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
commit 85428ad05347f94b536ebc9897cd48c2411f655e
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Thu Aug 1 02:17:23 2019 +0200
[MDEP-653] simplified default log
---
.../projects/purge-local-repository-multi-module/verify.groovy | 4 ++--
src/it/projects/purge-local-repository/verify.groovy | 2 +-
.../maven/plugins/dependency/PurgeLocalRepositoryMojo.java | 10 ++++------
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/it/projects/purge-local-repository-multi-module/verify.groovy b/src/it/projects/purge-local-repository-multi-module/verify.groovy
index c15a4a9..81fd494 100644
--- a/src/it/projects/purge-local-repository-multi-module/verify.groovy
+++ b/src/it/projects/purge-local-repository-multi-module/verify.groovy
@@ -30,6 +30,6 @@ checkFileAbsence("purged-a" );
checkFileAbsence("purged-b" );
String buildLog = new File( basedir, "build.log" ).getText( "UTF-8" );
-assert buildLog.contains( 'Deleting 1 transitive dependency for project org.apache.maven.its.dependency:child1:1.0-SNAPSHOT from ' );
-assert buildLog.contains( 'Deleting 1 transitive dependency for project org.apache.maven.its.dependency:child2:1.0-SNAPSHOT from ' );
+assert buildLog.contains( 'Deleting 1 transitive dependency for project child1 from ' );
+assert buildLog.contains( 'Deleting 1 transitive dependency for project child2 from ' );
assert buildLog.contains( 'with artifact version resolution fuzziness' );
diff --git a/src/it/projects/purge-local-repository/verify.groovy b/src/it/projects/purge-local-repository/verify.groovy
index 404ae38..ffb1734 100644
--- a/src/it/projects/purge-local-repository/verify.groovy
+++ b/src/it/projects/purge-local-repository/verify.groovy
@@ -30,5 +30,5 @@ void checkFileAbsence( String path )
checkFileAbsence( "org/apache/maven/its/dependency/purged/1.0/purged-1.0.jar" );
String buildLog = new File( basedir, "build.log" ).getText( "UTF-8" );
-assert buildLog.contains( 'Deleting 1 transitive dependency for project org.apache.maven.its.dependency:test:1.0-SNAPSHOT from ' );
+assert buildLog.contains( 'Deleting 1 transitive dependency for project test from ' );
assert buildLog.contains( 'with artifact version resolution fuzziness' );
diff --git a/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java b/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
index a628a58..5ddcf66 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java
@@ -586,8 +586,6 @@ public class PurgeLocalRepositoryMojo
private Set<Artifact> getFilteredResolvedArtifacts( MavenProject theProject, List<Dependency> dependencies,
TransformableFilter filter )
{
- verbose( "Resolve dependencies for: " + getProjectKey( theProject ) );
-
try
{
Iterable<ArtifactResult> results =
@@ -656,7 +654,7 @@ public class PurgeLocalRepositoryMojo
File deleteTarget = findDeleteTarget( artifact );
- getLog().info( "Deleting: " + deleteTarget );
+ verbose( "Deleting: " + deleteTarget );
if ( deleteTarget.isDirectory() )
{
@@ -688,6 +686,8 @@ public class PurgeLocalRepositoryMojo
// because Maven 2 will not automatically re-resolve them when resolving the artifact
for ( Artifact artifact : artifacts )
{
+ verbose( "Resolving artifact: " + artifact.getId() );
+
try
{
//CHECKSTYLE_OFF: LineLength
@@ -705,8 +705,6 @@ public class PurgeLocalRepositoryMojo
for ( Artifact artifact : artifacts )
{
- verbose( "Resolving artifact: " + artifact.getId() );
-
try
{
artifactResolver.resolveArtifact( session.getProjectBuildingRequest(), artifact );
@@ -768,7 +766,7 @@ public class PurgeLocalRepositoryMojo
private String getProjectKey( MavenProject project )
{
- return project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
+ return project.getArtifactId();
}
/**