Hi Jason,

On 7/30/16 5:48 PM, Jason van Zyl wrote:
You know there’s code in there for running segments of the lifecycle Igor put 
in there about 18 months ago?

I have found something which is called

DefaultLifecycleTaskSegmentCalculator (with a method: calculateTaskSegments( MavenSession session, List<String> tasks ))...which I though i need to change which was wrong...afterwards I have taken a deeper look into DefaultLifecycleExecutionPlanCalculator which i have modified....

Are you talking about them ?

I have taken a look here:

public List<MojoExecution> calculateMojoExecutions( MavenSession session, MavenProject project, List<Object> tasks ) throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
        PluginVersionResolutionException, LifecyclePhaseNotFoundException
.....

Map<String, List<MojoExecution>> phaseToMojoMapping =
     calculateLifecycleMappings( session, project, lifecyclePhase );

for ( List<MojoExecution> mojoExecutionsFromLifecycle : phaseToMojoMapping.values() )
{
  mojoExecutions.addAll( mojoExecutionsFromLifecycle );
}

Where I need to do some filtering about which phases are left over for execution...

Maybe this can be done in a more elegant ways...but as the first step it shows me that it worked...

The basic startpoint for this was a discussions about build pipelines which I had which gave me the trigger to think about the life cycle and asked myself: Is it possible to run only parts of the life cycle ? And yes it's possible.... performance was not in my mind but of course it is a point (and yes if all plugins behave correctly it would not be neccessary at all)...

The basic question is: Does it make sense to separate the life cycle in build pipelines? At moment I would say No...but may be others have different opinions.....

On the other hand it would make things possible like to check first the compilability of modules (and give very fast feedback to devs) and afterwards run the tests...(within a second step of the pipeline)...

I'm not sure in the end if it is something usefull ? Or may be I don't have right use case for it?


Yes also I'm aware that this would cause many headaches on the user site if they get failures by using (if we would make such feature available for users):

mvn install..deploy

For me it's clear why this does not work, but for the user this is a different story...


Kind regards
Karl Heinz





On Jul 30, 2016, at 11:25 AM, Karl Heinz Marbaise <[email protected]> wrote:

Hi,

currently I've written a PoC to define a life cycle range on command line like 
this:

mvn generate-sources..generate-resources

which will run only the life cycle phases from generate-sources (incl.) to 
generate-resources (incl.)...

This works so far:

$ mvn pre-integration-test..post-integration-test -Prun-its

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building The MultiEnv Maven Plugin 0.3.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- mrm-maven-plugin:1.0.0:start (default) @ multienv-maven-plugin ---
[INFO] Configuring Mock Repository Manager...
[INFO]   Mock content (source: 
/Users/kama/ws-git/multienv-maven-plugin/src/it-repo)
[INFO]   Proxy (source: this Maven session)
[INFO] Starting Mock Repository Manager
[INFO] Logging to Logger[org.mortbay.log]@1378737388 via 
org.mortbay.log.Slf4jLog
[INFO] jetty-6.1.5
[INFO] Started [email protected]:52355
[INFO] Mock Repository Manager http://localhost:52355 is started.
[INFO] Setting property 'repository.proxy.url' to 'http://localhost:52355'.
[INFO]
[INFO] --- maven-invoker-plugin:2.0.0:install (pre-integration-tests) @ 
multienv-maven-plugin ---
[INFO] Installing /Users/kama/ws-git/multienv-maven-plugin/pom.xml to 
/Users/kama/ws-git/multienv-maven-plugin/target/local-repo/com/soebes/maven/plugins/multienv-maven-plugin/0.3.0-SNAPSHOT/multienv-maven-plugin-0.3.0-SNAPSHOT.pom
[INFO]
[INFO] --- maven-invoker-plugin:2.0.0:run (integration-tests) @ 
multienv-maven-plugin ---
[INFO] Building: setup/pom.xml
[INFO] ..SUCCESS (2.0 s)
[INFO] Building: basicConfigurationTest/pom.xml
[INFO] run script verify.groovy
[INFO] ..SUCCESS (4.5 s)
[INFO] Building: basicConfigurationZipTest/pom.xml
[INFO] run script verify.groovy
[INFO] ..SUCCESS (4.0 s)
[INFO] Building: basicTest/pom.xml
[INFO] run script verify.groovy
[INFO] ..SUCCESS (4.1 s)
[INFO] Building: filteringTest/pom.xml
[INFO] run script verify.groovy
[INFO] ..SUCCESS (3.8 s)
[INFO] Building: jarTest/pom.xml
[INFO] run script verify.groovy
[INFO] ..SUCCESS (3.7 s)
[INFO] Building: noDebugTest/pom.xml
[INFO] run script verify.groovy
[INFO] ..SUCCESS (4.0 s)
[INFO] Building: supplementalFolderTest/pom.xml
[INFO] run script verify.groovy
[INFO] ..SUCCESS (4.0 s)
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO]   Passed: 8, Failed: 0, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[INFO]
[INFO] --- mrm-maven-plugin:1.0.0:stop (default) @ multienv-maven-plugin ---
[INFO] Stopping Mock Repository Manager on http://localhost:52355
[INFO] Mock Repository Manager http://localhost:52355 is stopped.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.422 s
[INFO] Finished at: 2016-07-30T17:12:35+02:00
[INFO] Final Memory: 23M/449M
[INFO] ------------------------------------------------------------------------

Also it looks like working to do things like this:

mvn package..install

But what does not work is:

mvn install..deploy

cause Maven complains like this.

[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-install-plugin:2.5.2:install (default-install) on 
project assembly: The packaging for this project did not assign a file to the 
build artifact -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the...

Cause the package phase did add artifacts to the projects...

So the question comes up: How can this be prevented...

The following works:

mvn package..deploy


Furthermore I'm thinking about doing things like this:

mvn [test]

To run only the life cycle phase test ...without the preliminary phases...

WDYT ?

Kind regards
Karl Heinz Marbaise

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Thanks,

Jason


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to