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/07 07:30:47 UTC
[GitHub] [maven-install-plugin] cstamas opened a new pull request #15: [MINSTALL-115] Install At End feature (no extension)
cstamas opened a new pull request #15:
URL: https://github.com/apache/maven-install-plugin/pull/15
This PR makes installAtEnd work as expected even
if maven-install-plugin is not used as extension.
How it works: it uses mojo Contexts to store "markers":
* presence of marker means project was "processed"
* value of marker tells what should be done (true = install, false = skipped)
UTs adjusted to provide plugin context (was null before).
Plugin updated (as required by maven-plugin-testing-harness) and
cleaned up.
---
https://issues.apache.org/jira/browse/MINSTALL-115
--
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-install-plugin] slawekjaranowski commented on a change in pull request #15: [MINSTALL-115] Install At End feature (no extension)
Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on a change in pull request #15:
URL: https://github.com/apache/maven-install-plugin/pull/15#discussion_r752748545
##########
File path: src/main/java/org/apache/maven/plugins/install/InstallMojo.java
##########
@@ -91,53 +86,68 @@
public void execute()
throws MojoExecutionException, MojoFailureException
{
+
+ final String projectKey = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
boolean addedInstallRequest = false;
if ( skip )
{
+ getPluginContext().put( INSTALL_PROCESSED_MARKER, Boolean.FALSE );
getLog().info( "Skipping artifact installation" );
}
else
{
- // CHECKSTYLE_OFF: LineLength
- ProjectInstallerRequest projectInstallerRequest =
- new ProjectInstallerRequest().setProject( project );
- // CHECKSTYLE_ON: LineLength
-
if ( !installAtEnd )
{
- installProject( session.getProjectBuildingRequest(), projectInstallerRequest );
+ installProject( project );
}
else
{
- INSTALLREQUESTS.add( projectInstallerRequest );
+ getPluginContext().put( INSTALL_PROCESSED_MARKER, Boolean.TRUE );
addedInstallRequest = true;
}
}
- boolean projectsReady = READYPROJECTSCOUNTER.incrementAndGet() == reactorProjects.size();
- if ( projectsReady )
+ if ( allProjectsMarked() )
{
- synchronized ( INSTALLREQUESTS )
+ for ( MavenProject reactorProject : reactorProjects )
{
- while ( !INSTALLREQUESTS.isEmpty() )
+ Map<String, Object> pluginContext = session.getPluginContext( pluginDescriptor, reactorProject );
+ Boolean install = (Boolean) pluginContext.get( INSTALL_PROCESSED_MARKER );
+ if ( !install )
{
- installProject( session.getProjectBuildingRequest(), INSTALLREQUESTS.remove( 0 ) );
+ getLog().info( "Project " + projectKey + " skipped install" );
Review comment:
`projectKey` should be computed from `reactorProject` in this place
--
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-install-plugin] cstamas commented on a change in pull request #15: [MINSTALL-115] Install At End feature (no extension)
Posted by GitBox <gi...@apache.org>.
cstamas commented on a change in pull request #15:
URL: https://github.com/apache/maven-install-plugin/pull/15#discussion_r766053141
##########
File path: src/main/java/org/apache/maven/plugins/install/InstallMojo.java
##########
@@ -94,50 +89,70 @@ public void execute()
boolean addedInstallRequest = false;
if ( skip )
{
+ getPluginContext().put( INSTALL_PROCESSED_MARKER, Boolean.FALSE );
getLog().info( "Skipping artifact installation" );
}
else
{
- // CHECKSTYLE_OFF: LineLength
- ProjectInstallerRequest projectInstallerRequest =
- new ProjectInstallerRequest().setProject( project );
- // CHECKSTYLE_ON: LineLength
-
if ( !installAtEnd )
{
- installProject( session.getProjectBuildingRequest(), projectInstallerRequest );
+ installProject( project );
}
else
{
- INSTALLREQUESTS.add( projectInstallerRequest );
+ getPluginContext().put( INSTALL_PROCESSED_MARKER, Boolean.TRUE );
addedInstallRequest = true;
}
}
- boolean projectsReady = READYPROJECTSCOUNTER.incrementAndGet() == reactorProjects.size();
- if ( projectsReady )
+ if ( allProjectsMarked() )
Review comment:
If m-install-p is not present, will not, but all "standard" life-cycle has them. But true, if no m-install-p not present, will not work. Was thinking about `org.apache.maven.execution.MavenSession#getResult` (and use `org.apache.maven.execution.MavenExecutionResult#getBuildSummary` to check "is it done"), wdyt?
--
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-install-plugin] cstamas commented on a change in pull request #15: [MINSTALL-115] Install At End feature (no extension)
Posted by GitBox <gi...@apache.org>.
cstamas commented on a change in pull request #15:
URL: https://github.com/apache/maven-install-plugin/pull/15#discussion_r766046122
##########
File path: pom.xml
##########
@@ -120,13 +132,31 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.7.30</version>
+ <version>${slf4jVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
- <version>1.7.30</version>
+ <version>${slf4jVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-api</artifactId>
+ <version>${aetherVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-util</artifactId>
+ <version>${aetherVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-impl</artifactId>
+ <version>${aetherVersion}</version>
Review comment:
Pulled out these into https://github.com/apache/maven-install-plugin/pull/17
--
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-install-plugin] cstamas commented on a change in pull request #15: [MINSTALL-115] Install At End feature (no extension)
Posted by GitBox <gi...@apache.org>.
cstamas commented on a change in pull request #15:
URL: https://github.com/apache/maven-install-plugin/pull/15#discussion_r753021136
##########
File path: src/main/java/org/apache/maven/plugins/install/InstallMojo.java
##########
@@ -91,53 +86,68 @@
public void execute()
throws MojoExecutionException, MojoFailureException
{
+
+ final String projectKey = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
boolean addedInstallRequest = false;
if ( skip )
{
+ getPluginContext().put( INSTALL_PROCESSED_MARKER, Boolean.FALSE );
getLog().info( "Skipping artifact installation" );
}
else
{
- // CHECKSTYLE_OFF: LineLength
- ProjectInstallerRequest projectInstallerRequest =
- new ProjectInstallerRequest().setProject( project );
- // CHECKSTYLE_ON: LineLength
-
if ( !installAtEnd )
{
- installProject( session.getProjectBuildingRequest(), projectInstallerRequest );
+ installProject( project );
}
else
{
- INSTALLREQUESTS.add( projectInstallerRequest );
+ getPluginContext().put( INSTALL_PROCESSED_MARKER, Boolean.TRUE );
addedInstallRequest = true;
}
}
- boolean projectsReady = READYPROJECTSCOUNTER.incrementAndGet() == reactorProjects.size();
- if ( projectsReady )
+ if ( allProjectsMarked() )
{
- synchronized ( INSTALLREQUESTS )
+ for ( MavenProject reactorProject : reactorProjects )
{
- while ( !INSTALLREQUESTS.isEmpty() )
+ Map<String, Object> pluginContext = session.getPluginContext( pluginDescriptor, reactorProject );
+ Boolean install = (Boolean) pluginContext.get( INSTALL_PROCESSED_MARKER );
+ if ( !install )
{
- installProject( session.getProjectBuildingRequest(), INSTALLREQUESTS.remove( 0 ) );
+ getLog().info( "Project " + projectKey + " skipped install" );
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-install-plugin] gnodet commented on a change in pull request #15: [MINSTALL-115] Install At End feature (no extension)
Posted by GitBox <gi...@apache.org>.
gnodet commented on a change in pull request #15:
URL: https://github.com/apache/maven-install-plugin/pull/15#discussion_r760889196
##########
File path: pom.xml
##########
@@ -120,13 +132,31 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>1.7.30</version>
+ <version>${slf4jVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
- <version>1.7.30</version>
+ <version>${slf4jVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-api</artifactId>
+ <version>${aetherVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-util</artifactId>
+ <version>${aetherVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.aether</groupId>
+ <artifactId>aether-impl</artifactId>
+ <version>${aetherVersion}</version>
Review comment:
It seems a bunch of changes are not really related to the `installAtEnd` problem and could be moved into a different commit.
##########
File path: src/main/java/org/apache/maven/plugins/install/InstallMojo.java
##########
@@ -94,50 +89,70 @@ public void execute()
boolean addedInstallRequest = false;
if ( skip )
{
+ getPluginContext().put( INSTALL_PROCESSED_MARKER, Boolean.FALSE );
getLog().info( "Skipping artifact installation" );
}
else
{
- // CHECKSTYLE_OFF: LineLength
- ProjectInstallerRequest projectInstallerRequest =
- new ProjectInstallerRequest().setProject( project );
- // CHECKSTYLE_ON: LineLength
-
if ( !installAtEnd )
{
- installProject( session.getProjectBuildingRequest(), projectInstallerRequest );
+ installProject( project );
}
else
{
- INSTALLREQUESTS.add( projectInstallerRequest );
+ getPluginContext().put( INSTALL_PROCESSED_MARKER, Boolean.TRUE );
addedInstallRequest = true;
}
}
- boolean projectsReady = READYPROJECTSCOUNTER.incrementAndGet() == reactorProjects.size();
- if ( projectsReady )
+ if ( allProjectsMarked() )
{
- synchronized ( INSTALLREQUESTS )
+ for ( MavenProject reactorProject : reactorProjects )
{
- while ( !INSTALLREQUESTS.isEmpty() )
+ Map<String, Object> pluginContext = session.getPluginContext( pluginDescriptor, reactorProject );
+ Boolean install = (Boolean) pluginContext.get( INSTALL_PROCESSED_MARKER );
+ if ( !install )
+ {
+ getLog().info(
+ "Project " + getProjectReferenceId( reactorProject ) + " skipped install"
+ );
+ }
+ else
{
- installProject( session.getProjectBuildingRequest(), INSTALLREQUESTS.remove( 0 ) );
+ installProject( reactorProject );
}
}
}
else if ( addedInstallRequest )
{
- getLog().info( "Installing " + project.getGroupId() + ":" + project.getArtifactId() + ":"
- + project.getVersion() + " at end" );
+ getLog().info( "Installing " + getProjectReferenceId( project ) + " at end" );
Review comment:
Can this log statement be moved a bit earlier when `addedInstallRequest` is set to `true` ?
##########
File path: src/main/java/org/apache/maven/plugins/install/InstallMojo.java
##########
@@ -94,50 +89,70 @@ public void execute()
boolean addedInstallRequest = false;
if ( skip )
{
+ getPluginContext().put( INSTALL_PROCESSED_MARKER, Boolean.FALSE );
getLog().info( "Skipping artifact installation" );
}
else
{
- // CHECKSTYLE_OFF: LineLength
- ProjectInstallerRequest projectInstallerRequest =
- new ProjectInstallerRequest().setProject( project );
- // CHECKSTYLE_ON: LineLength
-
if ( !installAtEnd )
{
- installProject( session.getProjectBuildingRequest(), projectInstallerRequest );
+ installProject( project );
}
else
{
- INSTALLREQUESTS.add( projectInstallerRequest );
+ getPluginContext().put( INSTALL_PROCESSED_MARKER, Boolean.TRUE );
addedInstallRequest = true;
}
}
- boolean projectsReady = READYPROJECTSCOUNTER.incrementAndGet() == reactorProjects.size();
- if ( projectsReady )
+ if ( allProjectsMarked() )
{
- synchronized ( INSTALLREQUESTS )
+ for ( MavenProject reactorProject : reactorProjects )
{
- while ( !INSTALLREQUESTS.isEmpty() )
+ Map<String, Object> pluginContext = session.getPluginContext( pluginDescriptor, reactorProject );
+ Boolean install = (Boolean) pluginContext.get( INSTALL_PROCESSED_MARKER );
+ if ( !install )
+ {
+ getLog().info(
+ "Project " + getProjectReferenceId( reactorProject ) + " skipped install"
+ );
Review comment:
This looks redundant with the log statement printed earlier `"Skipping artifact installation"`. This will print lots of line when the artifacts are actually installed for no benefit imho.
##########
File path: src/main/java/org/apache/maven/plugins/install/InstallMojo.java
##########
@@ -94,50 +89,70 @@ public void execute()
boolean addedInstallRequest = false;
if ( skip )
{
+ getPluginContext().put( INSTALL_PROCESSED_MARKER, Boolean.FALSE );
getLog().info( "Skipping artifact installation" );
}
else
{
- // CHECKSTYLE_OFF: LineLength
- ProjectInstallerRequest projectInstallerRequest =
- new ProjectInstallerRequest().setProject( project );
- // CHECKSTYLE_ON: LineLength
-
if ( !installAtEnd )
{
- installProject( session.getProjectBuildingRequest(), projectInstallerRequest );
+ installProject( project );
}
else
{
- INSTALLREQUESTS.add( projectInstallerRequest );
+ getPluginContext().put( INSTALL_PROCESSED_MARKER, Boolean.TRUE );
addedInstallRequest = true;
}
}
- boolean projectsReady = READYPROJECTSCOUNTER.incrementAndGet() == reactorProjects.size();
- if ( projectsReady )
+ if ( allProjectsMarked() )
Review comment:
Does this work if the last project being built does not have a standard lifecycle ? Or maybe this does not exist ?
--
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-install-plugin] gnodet commented on pull request #15: [MINSTALL-115] Install At End feature (no extension)
Posted by GitBox <gi...@apache.org>.
gnodet commented on pull request #15:
URL: https://github.com/apache/maven-install-plugin/pull/15#issuecomment-984413843
@cstamas This should not be affected by https://github.com/apache/maven/pull/625. The reason is that when the session is cloned (this is already the case currently), the map containing the plugin contexts [1] is simply copied into the new session, so that they are actually shared.
[1] https://github.com/apache/maven/blob/31954b441b3cc9eabe3f8566669928cf91fe824a/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java#L86-L87
--
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