elharo commented on code in PR #307:
URL:
https://github.com/apache/maven-remote-resources-plugin/pull/307#discussion_r4229605531
##########
src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java:
##########
@@ -532,28 +532,30 @@ protected List<MavenProject> getProjects() {
getLog().debug("PROJECTS: " + artifacts);
for (Artifact artifact : artifacts) {
- if (artifact.isSnapshot()) {
- artifact.setVersion(artifact.getBaseVersion());
- }
+ MavenProject p = findReactorProject(artifact, mavenSession);
Review Comment:
p --> project
in general, avoid single letter variable names
##########
src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java:
##########
@@ -532,28 +532,30 @@ protected List<MavenProject> getProjects() {
getLog().debug("PROJECTS: " + artifacts);
for (Artifact artifact : artifacts) {
- if (artifact.isSnapshot()) {
- artifact.setVersion(artifact.getBaseVersion());
- }
+ MavenProject p = findReactorProject(artifact, mavenSession);
+ if (p == null) {
+ if (artifact.isSnapshot()) {
+ artifact.setVersion(artifact.getBaseVersion());
+ }
- getLog().debug("Building project for " + artifact);
- MavenProject p;
- try {
- ProjectBuildingRequest req = new
DefaultProjectBuildingRequest()
-
.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL)
- .setProcessPlugins(false)
-
.setRepositorySession(mavenSession.getRepositorySession())
-
.setSystemProperties(mavenSession.getSystemProperties())
- .setUserProperties(mavenSession.getUserProperties())
- .setLocalRepository(mavenSession.getLocalRepository())
-
.setRemoteRepositories(project.getRemoteArtifactRepositories());
- ProjectBuildingResult res = projectBuilder.build(artifact,
req);
- p = res.getProject();
- } catch (ProjectBuildingException e) {
- getLog().warn("Invalid project model for artifact [" +
artifact.getGroupId() + ":"
- + artifact.getArtifactId() + ":" +
artifact.getVersion() + "]. "
- + "It will be ignored by the remote resources Mojo.");
- continue;
+ getLog().debug("Building project for " + artifact);
+ try {
+ ProjectBuildingRequest req = new
DefaultProjectBuildingRequest()
Review Comment:
req --> request or projectBuildingRequest
avoid abbreviations
##########
src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java:
##########
@@ -532,28 +532,30 @@ protected List<MavenProject> getProjects() {
getLog().debug("PROJECTS: " + artifacts);
for (Artifact artifact : artifacts) {
- if (artifact.isSnapshot()) {
- artifact.setVersion(artifact.getBaseVersion());
- }
+ MavenProject p = findReactorProject(artifact, mavenSession);
+ if (p == null) {
+ if (artifact.isSnapshot()) {
+ artifact.setVersion(artifact.getBaseVersion());
+ }
- getLog().debug("Building project for " + artifact);
- MavenProject p;
- try {
- ProjectBuildingRequest req = new
DefaultProjectBuildingRequest()
-
.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL)
- .setProcessPlugins(false)
-
.setRepositorySession(mavenSession.getRepositorySession())
-
.setSystemProperties(mavenSession.getSystemProperties())
- .setUserProperties(mavenSession.getUserProperties())
- .setLocalRepository(mavenSession.getLocalRepository())
-
.setRemoteRepositories(project.getRemoteArtifactRepositories());
- ProjectBuildingResult res = projectBuilder.build(artifact,
req);
- p = res.getProject();
- } catch (ProjectBuildingException e) {
- getLog().warn("Invalid project model for artifact [" +
artifact.getGroupId() + ":"
- + artifact.getArtifactId() + ":" +
artifact.getVersion() + "]. "
- + "It will be ignored by the remote resources Mojo.");
- continue;
+ getLog().debug("Building project for " + artifact);
+ try {
+ ProjectBuildingRequest req = new
DefaultProjectBuildingRequest()
+
.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL)
+ .setProcessPlugins(false)
+
.setRepositorySession(mavenSession.getRepositorySession())
+
.setSystemProperties(mavenSession.getSystemProperties())
+
.setUserProperties(mavenSession.getUserProperties())
+
.setLocalRepository(mavenSession.getLocalRepository())
+
.setRemoteRepositories(project.getRemoteArtifactRepositories());
+ ProjectBuildingResult res = projectBuilder.build(artifact,
req);
Review Comment:
res --> result
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]