You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/10/04 15:02:18 UTC
[GitHub] [maven-plugin-tools] cstamas opened a new pull request #38: [MPLUGIN-370] Check that Maven dependencies are provided scope
cstamas opened a new pull request #38:
URL: https://github.com/apache/maven-plugin-tools/pull/38
This PR has two changes:
* removed maven-artifact from maven-plugin-annotations (to not pull in
whole artifact just for 6 constants, thay may also cause havoc if
plugin developer does NOT declare maven-artifact with proper version)
* generator mojo now yells if ANY of the core dependencies are not
in proper scope.
https://issues.apache.org/jira/browse/MPLUGIN-370
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-plugin-tools] cstamas merged pull request #38: [MPLUGIN-370] Check that Maven dependencies are provided scope
Posted by GitBox <gi...@apache.org>.
cstamas merged pull request #38:
URL: https://github.com/apache/maven-plugin-tools/pull/38
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-plugin-tools] cstamas commented on a change in pull request #38: [MPLUGIN-370] Check that Maven dependencies are provided scope
Posted by GitBox <gi...@apache.org>.
cstamas commented on a change in pull request #38:
URL: https://github.com/apache/maven-plugin-tools/pull/38#discussion_r725114382
##########
File path: maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
##########
@@ -204,6 +204,25 @@ public void execute()
+ "In the future this error will break the build.\n\n" );
}
+ Set<Artifact> wrongScopedArtifacts = mavenDependenciesNotInProvidedScope();
+ if ( !wrongScopedArtifacts.isEmpty() )
+ {
+ StringBuilder errorMessage = new StringBuilder(
+ "\n\nMaven dependencies of Maven Plugins should be in provided scope.\n"
+ + "Please make sure that all your dependencies declared in POM whose group ID is\n"
+ + "org.apache.maven have set '<scope>provided</scope>' as well.\n"
+ + "In the future this error will break the build.\n\n"
+ + "The following dependencies are in wrong scope:\n"
+ );
+ for ( Artifact artifact : wrongScopedArtifacts )
+ {
+ errorMessage.append( " * " ).append( artifact ).append( "\n" );
Review comment:
While I agree, I mimicked the message one above, that also uses `\n` and is unrelated to this change. IMO, we should clean these up in separate PR if really needed, as if I fix this message only, thing will be even worse, as then mixed line endings will be emitted to console (if both warnings triggered for example).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-plugin-tools] rfscholte commented on a change in pull request #38: [MPLUGIN-370] Check that Maven dependencies are provided scope
Posted by GitBox <gi...@apache.org>.
rfscholte commented on a change in pull request #38:
URL: https://github.com/apache/maven-plugin-tools/pull/38#discussion_r724843735
##########
File path: maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
##########
@@ -204,6 +204,25 @@ public void execute()
+ "In the future this error will break the build.\n\n" );
}
+ Set<Artifact> wrongScopedArtifacts = mavenDependenciesNotInProvidedScope();
+ if ( !wrongScopedArtifacts.isEmpty() )
+ {
+ StringBuilder errorMessage = new StringBuilder(
+ "\n\nMaven dependencies of Maven Plugins should be in provided scope.\n"
+ + "Please make sure that all your dependencies declared in POM whose group ID is\n"
+ + "org.apache.maven have set '<scope>provided</scope>' as well.\n"
+ + "In the future this error will break the build.\n\n"
+ + "The following dependencies are in wrong scope:\n"
+ );
+ for ( Artifact artifact : wrongScopedArtifacts )
+ {
+ errorMessage.append( " * " ).append( artifact ).append( "\n" );
Review comment:
As this is written to the console, system specific line separators should be used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-plugin-tools] kwin commented on a change in pull request #38: [MPLUGIN-370] Check that Maven dependencies are provided scope
Posted by GitBox <gi...@apache.org>.
kwin commented on a change in pull request #38:
URL: https://github.com/apache/maven-plugin-tools/pull/38#discussion_r770767018
##########
File path: maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
##########
@@ -294,6 +313,26 @@ static String getDefaultGoalPrefix( MavenProject project )
return defaultGoalPrefix;
}
+ /**
+ * Collects all dependencies having {@code org.apache.maven} group ID that are NOT in provided scope.
+ */
+ private Set<Artifact> mavenDependenciesNotInProvidedScope()
+ {
+ LinkedHashSet<Artifact> wrongScopedDependencies = new LinkedHashSet<>();
+
+ for ( Artifact dependency : project.getArtifacts() )
+ {
+ if ( "org.apache.maven".equals( dependency.getGroupId() )
Review comment:
This leads to false positives: https://issues.apache.org/jira/browse/MPLUGIN-385?focusedCommentId=17460907&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17460907
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-plugin-tools] cstamas commented on a change in pull request #38: [MPLUGIN-370] Check that Maven dependencies are provided scope
Posted by GitBox <gi...@apache.org>.
cstamas commented on a change in pull request #38:
URL: https://github.com/apache/maven-plugin-tools/pull/38#discussion_r721605287
##########
File path: maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/ResolutionScope.java
##########
@@ -19,12 +19,13 @@
* under the License.
*/
-import org.apache.maven.artifact.Artifact;
-
/**
* Dependencies resolution scopes available before
* <a href="/ref/current/maven-core/apidocs/org/apache/maven/lifecycle/internal/MojoExecutor.html">mojo execution</a>.
*
+ * Important note: The {@code id} values of this enum corresponds to constants of
+ * {@code org.apache.maven.artifact.Artifact} class and MUST BE KEPT IN SYNC (not that they changed recently).
Review comment:
fixed
##########
File path: maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/ResolutionScope.java
##########
@@ -19,12 +19,13 @@
* under the License.
*/
-import org.apache.maven.artifact.Artifact;
-
/**
* Dependencies resolution scopes available before
* <a href="/ref/current/maven-core/apidocs/org/apache/maven/lifecycle/internal/MojoExecutor.html">mojo execution</a>.
*
+ * Important note: The {@code id} values of this enum corresponds to constants of
Review comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-plugin-tools] elharo commented on a change in pull request #38: [MPLUGIN-370] Check that Maven dependencies are provided scope
Posted by GitBox <gi...@apache.org>.
elharo commented on a change in pull request #38:
URL: https://github.com/apache/maven-plugin-tools/pull/38#discussion_r721561494
##########
File path: maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/ResolutionScope.java
##########
@@ -19,12 +19,13 @@
* under the License.
*/
-import org.apache.maven.artifact.Artifact;
-
/**
* Dependencies resolution scopes available before
* <a href="/ref/current/maven-core/apidocs/org/apache/maven/lifecycle/internal/MojoExecutor.html">mojo execution</a>.
*
+ * Important note: The {@code id} values of this enum corresponds to constants of
Review comment:
corresponds --> correspond
##########
File path: maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/ResolutionScope.java
##########
@@ -19,12 +19,13 @@
* under the License.
*/
-import org.apache.maven.artifact.Artifact;
-
/**
* Dependencies resolution scopes available before
* <a href="/ref/current/maven-core/apidocs/org/apache/maven/lifecycle/internal/MojoExecutor.html">mojo execution</a>.
*
+ * Important note: The {@code id} values of this enum corresponds to constants of
+ * {@code org.apache.maven.artifact.Artifact} class and MUST BE KEPT IN SYNC (not that they changed recently).
Review comment:
delete "(not that they changed recently)"
##########
File path: maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
##########
@@ -294,6 +313,25 @@ static String getDefaultGoalPrefix( MavenProject project )
return defaultGoalPrefix;
}
+ /**
+ * Collects all dependencies having {@code org.apache.maven} group Id that are NOT in provided scope.
Review comment:
Id --> ID
##########
File path: maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
##########
@@ -204,6 +204,25 @@ public void execute()
+ "In the future this error will break the build.\n\n" );
}
+ Set<Artifact> wrongScopedArtifacts = mavenDependenciesNotInProvidedScope();
+ if ( !wrongScopedArtifacts.isEmpty() )
+ {
+ StringBuilder errorMessage = new StringBuilder(
+ "\n\nMaven dependencies of Maven Plugins should be in provided scope.\n"
+ + "Please make sure that all your dependencies declared in POM having Group Id of\n"
+ + "org.apache.maven have set '<scope>provided</scope>' as well.\n"
+ + "In the future this error will break the build.\n\n"
+ + "Following dependencies are in wrong scope:\n"
Review comment:
The following
##########
File path: maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
##########
@@ -204,6 +204,25 @@ public void execute()
+ "In the future this error will break the build.\n\n" );
}
+ Set<Artifact> wrongScopedArtifacts = mavenDependenciesNotInProvidedScope();
+ if ( !wrongScopedArtifacts.isEmpty() )
+ {
+ StringBuilder errorMessage = new StringBuilder(
+ "\n\nMaven dependencies of Maven Plugins should be in provided scope.\n"
+ + "Please make sure that all your dependencies declared in POM having Group Id of\n"
Review comment:
"having Group Id of" --> whose group ID is
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [maven-plugin-tools] cstamas commented on a change in pull request #38: [MPLUGIN-370] Check that Maven dependencies are provided scope
Posted by GitBox <gi...@apache.org>.
cstamas commented on a change in pull request #38:
URL: https://github.com/apache/maven-plugin-tools/pull/38#discussion_r721604869
##########
File path: maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
##########
@@ -204,6 +204,25 @@ public void execute()
+ "In the future this error will break the build.\n\n" );
}
+ Set<Artifact> wrongScopedArtifacts = mavenDependenciesNotInProvidedScope();
+ if ( !wrongScopedArtifacts.isEmpty() )
+ {
+ StringBuilder errorMessage = new StringBuilder(
+ "\n\nMaven dependencies of Maven Plugins should be in provided scope.\n"
+ + "Please make sure that all your dependencies declared in POM having Group Id of\n"
+ + "org.apache.maven have set '<scope>provided</scope>' as well.\n"
+ + "In the future this error will break the build.\n\n"
+ + "Following dependencies are in wrong scope:\n"
Review comment:
fixed
##########
File path: maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
##########
@@ -204,6 +204,25 @@ public void execute()
+ "In the future this error will break the build.\n\n" );
}
+ Set<Artifact> wrongScopedArtifacts = mavenDependenciesNotInProvidedScope();
+ if ( !wrongScopedArtifacts.isEmpty() )
+ {
+ StringBuilder errorMessage = new StringBuilder(
+ "\n\nMaven dependencies of Maven Plugins should be in provided scope.\n"
+ + "Please make sure that all your dependencies declared in POM having Group Id of\n"
Review comment:
fixed
##########
File path: maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
##########
@@ -294,6 +313,25 @@ static String getDefaultGoalPrefix( MavenProject project )
return defaultGoalPrefix;
}
+ /**
+ * Collects all dependencies having {@code org.apache.maven} group Id that are NOT in provided scope.
Review comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org