Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
e289166
Bump version to 3.8.0-SNAPSHOT
michael-o Mar 16, 2021
02bc2a6
Add versionlessMavenDist profile
michael-o Feb 28, 2021
a96fd11
[MNG-3220] fix doc: dependencyManagement import require scope import
hboutemy Mar 13, 2021
09f77da
[MNG-7119] Upgrade Maven Wagon to 3.4.3
michael-o Mar 16, 2021
e5f6634
use Maven Resolver 1.6.2
hboutemy Mar 14, 2021
fa79cb2
[MNG-7116] add support for mirrorOf external:http:*
hboutemy Mar 13, 2021
899465a
[MNG-7117] add support for blocked mirror
hboutemy Mar 13, 2021
907d53a
[MNG-7118] block HTTP repositories by default
hboutemy Mar 13, 2021
6aa1f4a
[maven-release-plugin] prepare release maven-3.8.0
rfscholte Mar 21, 2021
dad8a3e
[maven-release-plugin] prepare for next development iteration
rfscholte Mar 21, 2021
a469068
next version in branch 3.8.x is 3.8.1-SNAPSHOT
hboutemy Mar 24, 2021
d295dc3
[MNG-7128] keep blocked attribute from mirrors in artifact repositories
hboutemy Mar 25, 2021
05c21c6
[maven-release-plugin] prepare release maven-3.8.1
rfscholte Mar 30, 2021
5213f43
[maven-release-plugin] prepare for next development iteration
rfscholte Mar 30, 2021
fbec4e7
[MNG-7152] Upgrade Maven Resolver to 1.6.3
michael-o May 11, 2021
cfe0537
[MNG-7155] upgrade maven-source-plugin from 3.2.0 to 3.2.1
hboutemy May 16, 2021
d6c9614
[MNG-7117] update link to settings xsd for version 1.2.0
hboutemy May 25, 2021
66a4381
[MNG-5868] No duplicate artifacts in attached artifacts
olamy Jun 1, 2020
68e02c2
[MNG-6071] Normalize relative paths for working directory
slachiewicz Jan 26, 2020
3645593
[MNG-6983] Plugin key can get out of sync with artifactId and groupId
Aug 24, 2020
2f144de
[MNG-6819] Fix NullPointerException in StringVisitorModelInterpolator
Dec 13, 2019
b5056e4
[MNG-6828] DependencyResolutionException breaks serialization
slachiewicz Jan 1, 2020
863f919
[MNG-6842] ProjectBuilderTest uses Guava, but Guava is not defined in…
KroArtem Jan 6, 2020
42c99b4
[MNG-6850] Prevent printing the EXEC_DIR when it's just a disk letter
rostidev Dec 31, 2019
76d5f0d
[MNG-6843] Parallel build fails due to missing JAR artifacts in compi…
famod Jun 25, 2021
a9f337f
[MNG-6937] StringSearchModelInterpolatorTest fails on symlinked paths
michael-o Jun 10, 2020
ce27f0e
[MNG-6964] Maven version sorting is internally inconsistent.
dennisl Jul 22, 2020
b476b28
[MNG-7000] metadata.mdo contains invalid link to schema
michael-o Oct 17, 2020
d4ad077
[MNG-6816] Prefer System.lineSeparator() over system properties
KroArtem Dec 9, 2019
3a465e1
[MNG-6837] Simplify detection of the MAVEN_HOME and make it fully qua…
rostidev Jan 1, 2020
5a89973
[MNG-7170] Allow to associate pomFile/${basedir} with DefaultProjectB…
mickaelistria Jun 11, 2021
bfd7c49
[MNG-7179] Upgrade Jansi to 2.3.3
rfscholte Jun 12, 2021
14ff5dd
[MNG-7177] Upgrade Maven Shared Utils to 3.3.4
michael-o Jun 30, 2021
73f34c0
[MNG-7172] Remove expansion of Jansi native libraries
rfscholte Jun 24, 2021
3925486
[MNG-7032] Evaluate --help and --version after configuring the loggin…
gnodet Jan 21, 2021
f98e632
[MNG-7080] Add a --color option to simplify color support
gnodet Jan 21, 2021
484e502
[MNG-7127] fix MavenCliTest.testStyleColors test in JDK 16
cchacin Mar 23, 2021
d862fdd
[MNG-6993] Upgrade SLF4J to 1.7.30
slawekjaranowski Sep 30, 2020
41efc13
[MNG-6886] upgrade plexus-cipher to 1.8 and update changed groupId (#…
olamy Apr 9, 2020
6f5c3d5
[MNG-6872] - Found CVEs in your dependencies - plexus-utils (tests)
khmarbaise Mar 8, 2020
01780c0
[MNG-6853] - Don't box primitives where it's not needed
rostidev Jan 22, 2020
a659ade
[MNG-6827] Replace deprecated StringUtils#defaultString() from Plexus…
KroArtem Dec 17, 2019
8edac61
[MNG-7149] Introduce MAVEN_DEBUG_ADDRESS in mvnDebug scripts
Dufgui Apr 25, 2021
b5ee583
[MNG-6859] Build not reproducible when built from source release
michael-o Feb 1, 2020
8f58b85
[MNG-7064] Use HTTPS for schema location in global settings.xml
michael-o Jan 4, 2021
9189425
[MNG-6967] Improve the command line output from maven-artifact.
dennisl Jul 22, 2020
40f1082
[MNG-6874] - Upgrade Maven Parent to 34
khmarbaise Mar 8, 2020
4259ba8
[MNG-6884] - Cleanup POM File after version upgrade
khmarbaise Apr 4, 2020
2a2392f
[MNG-6873] Align JUnit version to 4.13
kaifeng-h Mar 2, 2020
9ae1d95
[MNG-6844] Use StandardCharsets and remove outdated @SuppressWarnings
KroArtem Jan 9, 2020
8b693cc
Document hacks as such
michael-o Jul 2, 2021
7358b08
Add new ignores
michael-o Jul 3, 2021
7b355f7
[MNG-7180] Make --color option behave more like BSD/GNU grep's --colo…
michael-o Jul 3, 2021
7a8acdd
[MNG-7181] Make --version support -q
michael-o Jul 3, 2021
0635e92
[MNG-7184] document .mavenrc/mavenrc_pre.bat|cmd and MAVEN_SKIP_RC
hboutemy Jul 11, 2021
842e7c8
[MNG-7186] Upgrade Guice to 4.2.2
michael-o Jul 12, 2021
a27b4ee
[MNG-6987] Reorder groupId before artifactId when writing an exclusio…
mbruggmann Sep 10, 2020
5d6bb35
[MNG-6810] - Remove profiles in maven-model
khmarbaise Dec 7, 2019
5060349
[MNG-6811] - Remove unnecessary filtering configuration
khmarbaise Dec 7, 2019
f32c3db
[MNG-6471] Parallel builder should use the module name as thread name
rmannibucau Sep 6, 2018
a3907fc
[MNG-6754] Set the same timestamp in multi module builds
michael-o Oct 11, 2020
176b272
[MNG-7185] Describe explicit and recommended version for VersionRange…
breun Jul 13, 2021
268f956
Use proper term: directory
michael-o Jul 19, 2021
25df095
[MNG-7190] Load mavenrc from /usr/local/etc also in Bourne shell script
michael-o Jul 19, 2021
c395ca9
[MNG-7190] add /usr/local/etc/mavenrc to reference documentation
hboutemy Jul 20, 2021
b74199e
[MNG-7034] StackOverflowError thrown if a cycle exists in BOM imports
gnodet Nov 25, 2020
22a8cfa
[MNG-6648] 'mavenrc_pre' script does not receive arguments like maven…
michael-o Jul 22, 2021
f32eb09
[MNG-7010] Omit "NB: JAVA_HOME should point to a JDK not a JRE"
michael-o Jul 23, 2021
51f6d8b
[MNG-7196] Upgrade Jansi to 2.3.4
michael-o Jul 25, 2021
7ecdb3c
[MNG-7198] Upgrade SLF4J to 1.7.32
michael-o Jul 27, 2021
ea98e05
[maven-release-plugin] prepare release maven-3.8.2
michael-o Aug 4, 2021
865dcaa
[maven-release-plugin] prepare for next development iteration
michael-o Aug 4, 2021
9adb3ae
Document Maven 3.8.1 and 3.8.2 releases
michael-o Aug 13, 2021
4dc1159
Fix DOAP
michael-o Aug 14, 2021
547dfdd
Improve license handling
michael-o Jan 22, 2020
0c3fe07
[MNG-6818] - Upgrade plexus-utils 3.3.0
khmarbaise Dec 9, 2019
ccafe8b
[MNG-6841] update plexus-interpolation to 1.26
Jan 5, 2020
c76c9d9
[MNG-7246] Upgrade Plexus Cipher and Sec Dispatcher to 2.0
cstamas Sep 10, 2021
383cabf
[MNG-7216] [Regression] Revert MNG-7170
michael-o Aug 16, 2021
e08834b
[MNG-7250] Upgrade Sisu Inject/Plexus to 0.3.5
cstamas Sep 13, 2021
4e5b3d5
[MNG-7251] Fix threadLocalArtifactsHolder leaking into cloned project
famod Aug 22, 2021
1ea42b0
[MNG-7219] [Regression] plexus-cipher missing from transitive depende…
michael-o Sep 11, 2021
98a9d08
[MNG-7236] The DefaultPluginVersionResolver should cache results for …
gnodet Sep 9, 2021
93f9e85
[MNG-7045] Drop CDI API from Maven
rmannibucau Dec 3, 2020
d1aa1e1
[MNG-7252] Fix warnings issued by dependency:analyze
michael-o Sep 16, 2021
8c66edc
[MNG-7254] Expand Windows native libraries for Jansi due to JDK-81951…
michael-o Sep 16, 2021
ab54d17
[MNG-7253] Display relocation message defined in model
gastaldi Sep 17, 2021
8882a9c
[MNG-7164] Add constructor MojoExecutionException(Throwable)
ggregory-rocket May 29, 2021
0a6bbb8
[MNG-7235] Speed improvements when calculating the sorted project graph
gnodet Sep 9, 2021
ff8e977
[maven-release-plugin] prepare release maven-3.8.3
michael-o Sep 27, 2021
21e597e
[maven-release-plugin] prepare for next development iteration
michael-o Sep 27, 2021
b6186e2
Remove swap file
michael-o Sep 27, 2021
fb5f3f5
[MNG-7270] Switch to shell alternative to "which"
jmtd Sep 29, 2021
5c36bf5
[MNG-7312] Revert ThreadLocal approach from MNG-6843 and MNG-7251
michael-o Oct 16, 2021
c9a0366
Merge pull request #4 in ABFX/maven-forked from incremental-maven-3.6…
maximilian-novikov-db Aug 10, 2021
af3f957
fix typo
hboutemy Sep 12, 2021
803a8c4
add missing license
hboutemy Oct 17, 2021
fb40c4b
Make sure forked mojo executions have a correct phase set
gnodet Nov 3, 2021
b467ea4
Avoid IllegalStateException when cache is not enabled
gnodet Nov 3, 2021
a6bead7
[MNG-7324] first step to use Modello for cache-domain
hboutemy Oct 17, 2021
1ae6bd1
[MNG-7324] Complete modello switch
gnodet Nov 4, 2021
b6aab72
[MNG-7324] Use plurals in the schema, make sure it can read things
gnodet Nov 5, 2021
7c0c617
[MNG-7324] Allow more minimal config
gnodet Nov 5, 2021
b145fd9
[MNG-7324] remove now unused JAXB dependencies
hboutemy Nov 6, 2021
3794fd9
[MNG-7324] update documentation
hboutemy Nov 8, 2021
f51f914
[MNG-7324] split config/domain/diff/report to separate xml.* packages
hboutemy Nov 8, 2021
2c11bbf
[MNG-7324] rename domain to buildinfo and diff to buildsdiff
hboutemy Nov 8, 2021
0a6f1d3
[MNG-7321] Move caching in its own module
gnodet Nov 8, 2021
cf5566d
[MNG-7324] Use plural in lists, fix model
gnodet Nov 9, 2021
063b4b1
[MNG-7321] Include the new module in the distribution, uses CDI for a…
gnodet Nov 9, 2021
4694f6e
[MNG-7322] Use maven session / project properties instead of System.g…
gnodet Nov 9, 2021
1716c48
[MNG-7321] Use a provided scope for maven-core
gnodet Nov 9, 2021
c2c9c92
[MNG-7325] Rename namespaces, add more test for XmlService
gnodet Nov 9, 2021
f1d0d76
[MNG-7328] Remove the `Type` suffix on the generated model classes
gnodet Nov 9, 2021
0cfdda1
[MNG-7324] Update doc regarding model changes
gnodet Nov 9, 2021
73d1274
[MNG-7328] Fix tests
gnodet Nov 9, 2021
0eca9b6
[MNG-7324] Rename buildinfo -> build and buildsdiff -> diff
gnodet Nov 9, 2021
3705c0d
Merge branch 'MNG-7129_Separate' into MNG-7129-master
gnodet Nov 10, 2021
b80d035
[MNG-7327] Avoid guava usage
gnodet Nov 10, 2021
00322bf
[MNG-5577] Use JSR 330 constructor injection
gnodet Nov 10, 2021
2463099
[MNG-7321] cleanup build
hboutemy Nov 11, 2021
fe34637
[MNG-7321] move documentation to maven-caching module
hboutemy Nov 11, 2021
0061bfe
[MNG-7321] fix javadoc
hboutemy Nov 11, 2021
bbc8ed7
[MNG-7129] rename (Artifacts/Local)Repository to *CacheRepository
hboutemy Nov 11, 2021
eee28e2
[MNG-7129] fix typos
hboutemy Nov 11, 2021
1723cfd
[MNG-7129] Changes in maven core required to support incremental mave…
Nov 1, 2021
6a20fd5
[MNG-7329] Upgrade maven-enforcer-plugin
gnodet Nov 10, 2021
6057a33
[MNG-7331] Upgrade Jansi to 2.4.0
michael-o Nov 12, 2021
1a1c16c
[MNG-7334] Make the cache singletons reusable across maven sessions
gnodet Nov 15, 2021
7d05973
[MNG-7129] Remove references to unused LegacySupport, fix typo
gnodet Nov 15, 2021
fdab508
[MNG-7336] Define a Feature for caching
gnodet Nov 15, 2021
a057014
[MNG-7129] fix compilation
gnodet Nov 15, 2021
3d4fba3
[MNG-7129] More complete fix for missing lifecycle phases, avoid warn…
gnodet Nov 16, 2021
3786a38
[MNG-7337] Remove usage of plexus logger
gnodet Nov 16, 2021
d6aa918
Merge remote-tracking branch 'origin/master' into MNG-7129-master
gnodet Nov 16, 2021
3a42b61
[MNG-7129] Use @SessionScoped annotation
gnodet Nov 16, 2021
8af9220
Fix wrong usage of `project.getAttachedArtifacts().clear()`
gnodet Nov 16, 2021
219b4aa
[MNG-7337] Fix broken integration tests due to early logging
gnodet Nov 16, 2021
5d80e2e
[MNG-7129] Rely on the DefaultLifecycles instead of hard-coded list o…
gnodet Nov 17, 2021
c62e3fe
[MNG-7129] Fix lifecycles
gnodet Nov 17, 2021
a074408
Remove Utils and rename ProjectUtils to CacheUtils
gnodet Nov 17, 2021
8ac204b
Avoid using deprecated class and fix NPE
gnodet Nov 17, 2021
178f143
Fix DigestUtils log to stdout and use JDK8 lambda for thread local in…
gnodet Nov 17, 2021
ca53648
Merge SessionUtils and ZipUtils into CacheUtils
gnodet Nov 17, 2021
e9b633e
Inline Clock utility class, remove unused CacheUtils methods
gnodet Nov 17, 2021
cff3780
Avoid possible NPE if no build is defined in the pom
gnodet Nov 17, 2021
a928405
Use a LifecycleParticipant as they can be session scoped
gnodet Nov 17, 2021
c80847b
Cleanup
gnodet Nov 17, 2021
03bc795
Remove empty lines after block start
gnodet Nov 17, 2021
db51f87
Merge branch 'deutschebank-MNG-7129/caching-support-core-changes-mast…
gnodet Nov 17, 2021
c095e55
MNG-7129: caching extension
andrey-petrenko-db Nov 17, 2021
008fd60
MNG-7129: caching extension
andrey-petrenko-db Nov 17, 2021
5065d8a
MNG-7129: caching extension
andrey-petrenko-db Nov 17, 2021
82c445e
[MNG-7129] Cache extension test fix
Nov 17, 2021
c581c0d
MNG-7129: no need for a lazy initialization, prefer a final field
gnodet Nov 18, 2021
a0b14a8
MNG-7129: retrieve the hashFactory directly from the cache config
gnodet Nov 18, 2021
240ca7b
Revert c581c0d5a1c567986f33510b174f64dcd4fdd6e6 as the projects are n…
gnodet Nov 18, 2021
0d693e5
Minimize changes in maven-core
gnodet Nov 18, 2021
0dc3db7
Use a lambda expression
gnodet Nov 18, 2021
f306fca
Do not include maven-caching in the distribution
gnodet Nov 19, 2021
f017965
Fix problems when restoring projects that do not have any packaged ar…
gnodet Nov 22, 2021
806eb33
Add missing commons-lang3 dependency
gnodet Nov 22, 2021
2157ad2
[MNG-7129] Remove redundant remote calls
Nov 20, 2021
1b7fee5
[MNG-7129] Restore artifacts from cache lazily (#614)
AlexanderAshitkin Nov 23, 2021
6aeeea1
[MNG-7129] Rework http repo to java 8
Nov 23, 2021
a81aa53
Merge pull request #15 in ABFX/maven-forked from feature/http-repo-ja…
Nov 23, 2021
8b3b955
[MNG-7129] Rework http repo to java 8
Nov 23, 2021
271d915
Merge feature/http-repo-java8 to MNG-7129/master-db
Nov 23, 2021
e4a05db
MNG-7129: caching extension
andrey-petrenko-db Nov 24, 2021
74cf06f
MNG-7129: caching extension
andrey-petrenko-db Nov 25, 2021
dba502f
Revert "[MNG-7336] Define a Feature for caching"
gnodet Nov 25, 2021
3f09c81
MNG-7129: caching extension
andrey-petrenko-db Nov 25, 2021
f30ca4e
Ensure the extension can be used from the POM
gnodet Nov 25, 2021
bf02640
Add a wagon based provide to support mirror / proxy / authentication
gnodet Nov 25, 2021
9cc0d92
Fix compilation
gnodet Nov 25, 2021
535448d
Merge branch 'MNG-7129-master' of https://stash.gto.intranet.db.com:8…
Nov 25, 2021
316443f
Add a wagon based provide to support mirror / proxy / authentication
gnodet Nov 25, 2021
8461793
[MNG-7129] Rework http repo to java 8 - update of wagon repo
Nov 25, 2021
cd22a77
[MNG-7129] Rework http repo to java 8 - update of wagon repo
Nov 25, 2021
e9caf56
Merge pull request #18 in ABFX/maven-forked from MNG-7129/master-db-m…
andrey-petrenko-db Nov 25, 2021
c73b5e2
Merge branch 'deutschebank-MNG-7129/master-db' into MNG-7129-master
gnodet Nov 25, 2021
5bbff6c
Merge pull request #17 in ABFX/maven-forked from MNG-7129/master-db-s…
andrey-petrenko-db Nov 25, 2021
a9728bf
Merge remote-tracking branch 'origin/MNG-7129-master' into MNG-7129/m…
andrey-petrenko-db Nov 25, 2021
9480798
MNG-7129: caching extension merge mng-7129-master
andrey-petrenko-db Nov 25, 2021
4759c27
Avoid using an in-memory buffer when downloading artifacts as they ca…
gnodet Nov 26, 2021
02fada0
Add a configurable id to the remote repository
gnodet Nov 26, 2021
b2e4577
Allow usage of an empty config file which provides local-cache only
gnodet Nov 26, 2021
2c19c37
Make errors during downloads are reported during eagerly restoration …
gnodet Nov 26, 2021
8ad2c84
Tone down errors during restoration
gnodet Nov 26, 2021
a35508a
Merge remote-tracking branch 'origin/MNG-7129-master' into MNG-7129/m…
andrey-petrenko-db Nov 26, 2021
d649bee
MNG-7129: caching extension merge mng-7129-master
andrey-petrenko-db Nov 26, 2021
65bbe0b
MNG-7129: caching extension merge mng-7129-master
andrey-petrenko-db Nov 26, 2021
ead5595
MNG-7129: caching extension merge mng-7129-master
andrey-petrenko-db Nov 26, 2021
e6af0c3
MNG-7129: caching extension merge mng-7129-master
andrey-petrenko-db Nov 26, 2021
06c86b3
MNG-7129: support project versions change and sub-tree build
andrey-petrenko-db Nov 28, 2021
5efecfe
MNG-7129: support project versions change and sub-tree build
andrey-petrenko-db Nov 28, 2021
391f9d0
MNG-7129: support project versions change and sub-tree build
andrey-petrenko-db Nov 29, 2021
57e627a
Merge remote-tracking branch 'origin/master' into MNG-7129-master
gnodet Nov 30, 2021
11e90b5
Merge branch 'deutschebank-MNG-7129/master-db-subtree-feature' into M…
gnodet Nov 30, 2021
bc3304a
Extract maven-caching
gnodet Nov 30, 2021
dc58d4b
Remove unwanted changes
gnodet Nov 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@Singleton
public class DefaultLifecycles
{
public static final String[] STANDARD_LIFECYCLES = { "default", "clean", "site", "wrapper" };
public static final String[] STANDARD_LIFECYCLES = { "clean", "default", "site", "wrapper" };

private final Logger logger = LoggerFactory.getLogger( getClass() );

Expand Down Expand Up @@ -117,6 +117,9 @@ public Map<String, Lifecycle> getPhaseToLifecycleMap()
return phaseToLifecycleMap;
}

/**
* Returns an ordered list of lifecycles
*/
public List<Lifecycle> getLifeCycles()
{
List<String> lifecycleIds = Arrays.asList( STANDARD_LIFECYCLES );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
* under the License.
*/

import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down Expand Up @@ -110,7 +108,7 @@ public Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging )

Map<Plugin, Plugin> plugins = new LinkedHashMap<>();

for ( Lifecycle lifecycle : getOrderedLifecycles() )
for ( Lifecycle lifecycle : defaultLifeCycles.getLifeCycles() )
{
org.apache.maven.lifecycle.mapping.Lifecycle lifecycleConfiguration =
lifecycleMappingForPackaging.getLifecycles().get( lifecycle.getId() );
Expand Down Expand Up @@ -163,17 +161,6 @@ private LifecycleMapping lookupLifecycleMapping( final String packaging )
}
}

private List<Lifecycle> getOrderedLifecycles()
{
// NOTE: The lifecycle order can affect implied execution ids so we better be deterministic.

List<Lifecycle> lifecycles = new ArrayList<>( defaultLifeCycles.getLifeCycles() );

lifecycles.sort( Comparator.comparing( Lifecycle::getId ) );

return lifecycles;
}

private void parseLifecyclePhaseDefinitions( Map<Plugin, Plugin> plugins, String phase, LifecyclePhase goals )
{
InputSource inputSource = new InputSource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.apache.maven.plugin.MavenPluginManager;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojosExecutionStrategy;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.PluginConfigurationException;
import org.apache.maven.plugin.PluginIncompatibleException;
Expand Down Expand Up @@ -71,18 +72,22 @@ public class MojoExecutor
private final MavenPluginManager mavenPluginManager;
private final LifecycleDependencyResolver lifeCycleDependencyResolver;
private final ExecutionEventCatapult eventCatapult;
private final MojosExecutionStrategy mojosExecutionStrategy;

@Inject
public MojoExecutor(
BuildPluginManager pluginManager,
MavenPluginManager mavenPluginManager,
LifecycleDependencyResolver lifeCycleDependencyResolver,
ExecutionEventCatapult eventCatapult )
ExecutionEventCatapult eventCatapult,
MojosExecutionStrategy mojosExecutionStrategy
)
{
this.pluginManager = pluginManager;
this.mavenPluginManager = mavenPluginManager;
this.lifeCycleDependencyResolver = lifeCycleDependencyResolver;
this.eventCatapult = eventCatapult;
this.mojosExecutionStrategy = mojosExecutionStrategy;
}

public DependencyContext newDependencyContext( MavenSession session, List<MojoExecution> mojoExecutions )
Expand Down Expand Up @@ -148,13 +153,11 @@ public void execute( MavenSession session, List<MojoExecution> mojoExecutions, P

PhaseRecorder phaseRecorder = new PhaseRecorder( session.getCurrentProject() );

for ( MojoExecution mojoExecution : mojoExecutions )
{
execute( session, mojoExecution, projectIndex, dependencyContext, phaseRecorder );
}
mojosExecutionStrategy.execute( mojoExecutions, session, mojoExecution ->
execute( session, mojoExecution, projectIndex, dependencyContext, phaseRecorder ) );
}

public void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex,
private void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex,
DependencyContext dependencyContext, PhaseRecorder phaseRecorder )
throws LifecycleExecutionException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package org.apache.maven.plugin;

/*
* 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 org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.LifecycleExecutionException;

import javax.inject.Named;
import javax.inject.Singleton;
import java.util.List;

/**
* Default mojo execution strategy. It just iterates over mojo executions and runs one by one
*/
@Named
@Singleton
public class DefaultMojosExecutionStrategy implements MojosExecutionStrategy
{
@Override
public void execute( List<MojoExecution> mojos, MavenSession session, MojoExecutionRunner mojoRunner )
throws LifecycleExecutionException
{
for ( MojoExecution mojoExecution : mojos )
{
mojoRunner.run( mojoExecution );
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.apache.maven.plugin;

/*
* 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 org.apache.maven.lifecycle.LifecycleExecutionException;

/**
* Provides context for mojo execution. Invocation of #run will result in actual execution
*/
@FunctionalInterface
public interface MojoExecutionRunner
{
/**
* Runs mojo execution
*
* @param execution mojo execution
* @throws LifecycleExecutionException
*/
void run( MojoExecution execution ) throws LifecycleExecutionException;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package org.apache.maven.plugin;

/*
* 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 org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.LifecycleExecutionException;

import java.util.List;

/**
* Interface allows overriding default mojo execution strategy For example it is possible wrap some mojo execution to
* decorate default functionality or skip some executions
*/
public interface MojosExecutionStrategy
{

/**
* Entry point to the execution strategy
*
* @param mojos list of mojos representing a project build
* @param session current session
* @param mojoExecutionRunner mojo execution task which must be invoked by a strategy to actually run it
* @throws LifecycleExecutionException
*/
void execute( List<MojoExecution> mojos, MavenSession session, MojoExecutionRunner mojoExecutionRunner )
throws LifecycleExecutionException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,21 @@ public <T> T getConfiguredMojo( Class<T> mojoInterface, MavenSession session, Mo

ClassRealm pluginRealm = pluginDescriptor.getClassRealm();

if ( pluginRealm == null )
{
try
{
setupPluginRealm( pluginDescriptor, session, null, null, null );
}
catch ( PluginResolutionException e )
{
String msg = "Cannot setup plugin realm [mojoDescriptor=" + mojoDescriptor.getId()
+ ", pluginDescriptor=" + pluginDescriptor.getId() + "]";
throw new PluginConfigurationException( pluginDescriptor, msg, e );
}
pluginRealm = pluginDescriptor.getClassRealm();
}

if ( logger.isDebugEnabled() )
Comment thread
gnodet marked this conversation as resolved.
{
logger.debug( "Configuring mojo " + mojoDescriptor.getId() + " from plugin realm " + pluginRealm );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public void testCustomLifecycle()
DefaultLifecycles dl = new DefaultLifecycles( myLifecycles.stream()
.collect( Collectors.toMap( l -> l.getId(), l -> l ) ) );

assertThat( dl.getLifeCycles().get( 0 ).getId(), is( "default" ) );
assertThat( dl.getLifeCycles().get( 1 ).getId(), is( "clean" ) );
assertThat( dl.getLifeCycles().get( 0 ).getId(), is( "clean" ) );
assertThat( dl.getLifeCycles().get( 1 ).getId(), is( "default" ) );
assertThat( dl.getLifeCycles().get( 2 ).getId(), is( "site" ) );
assertThat( dl.getLifeCycles().get( 3 ).getId(), is( "wrapper" ) );
assertThat( dl.getLifeCycles().get( 4 ).getId(), is( "etl" ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@

import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.LifecycleExecutionException;
import org.apache.maven.lifecycle.internal.DependencyContext;
import org.apache.maven.lifecycle.internal.ExecutionEventCatapult;
import org.apache.maven.lifecycle.internal.LifecycleDependencyResolver;
import org.apache.maven.lifecycle.internal.MojoExecutor;
import org.apache.maven.lifecycle.internal.PhaseRecorder;
import org.apache.maven.lifecycle.internal.ProjectIndex;
import org.apache.maven.plugin.BuildPluginManager;
import org.apache.maven.plugin.MavenPluginManager;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojosExecutionStrategy;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;

import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -46,24 +46,23 @@ public MojoExecutorStub(
BuildPluginManager pluginManager,
MavenPluginManager mavenPluginManager,
LifecycleDependencyResolver lifeCycleDependencyResolver,
ExecutionEventCatapult eventCatapult )
ExecutionEventCatapult eventCatapult,
MojosExecutionStrategy mojosExecutionStrategy )
{
super( pluginManager, mavenPluginManager, lifeCycleDependencyResolver, eventCatapult );
super( pluginManager, mavenPluginManager, lifeCycleDependencyResolver, eventCatapult, mojosExecutionStrategy );
}

@Override
public void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex,
DependencyContext dependencyContext, PhaseRecorder phaseRecorder )
public void execute( MavenSession session, List<MojoExecution> mojoExecutions, ProjectIndex projectIndex )
throws LifecycleExecutionException
{
executions.add( mojoExecution );
executions.addAll(mojoExecutions);
}

@Override
public void execute( MavenSession session, List<MojoExecution> mojoExecutions, ProjectIndex projectIndex )
throws LifecycleExecutionException
public List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session, ProjectIndex projectIndex ) throws LifecycleExecutionException
{
executions.addAll(mojoExecutions);
return null;
}


Expand Down