Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tiles-maven-plugin does not work under Maven 4 #157

Open
talios opened this issue Sep 17, 2024 · 2 comments
Open

tiles-maven-plugin does not work under Maven 4 #157

talios opened this issue Sep 17, 2024 · 2 comments

Comments

@talios
Copy link
Member

talios commented Sep 17, 2024

It looks like looking up ArtifactRepositoryLayout's under Maven 4 fails.

The code used to lookup the layout by name is:

repositoryLayouts = mavenSession.lookupMap(ArtifactRepositoryLayout.class.getName()) as Map<String, ArtifactRepositoryLayout>

and is used to dynamically lookup the distribution repository layout when constructing a new MavenArtifactRepository instance to inject.

This is now deprecated, but nothing in the Maven source mentions what should be done instead of using it.

[ERROR] Internal error: java.lang.NullPointerException: Cannot invoke "org.codehaus.plexus.PlexusContainer.lookupMap(String)" because "this.container" is null -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException: Cannot invoke "org.codehaus.plexus.PlexusContainer.lookupMap(String)" because "this.container" is null
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:157)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:981)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:291)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:208)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke(Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
Caused by: java.lang.NullPointerException: Cannot invoke "org.codehaus.plexus.PlexusContainer.lookupMap(String)" because "this.container" is null
    at org.apache.maven.execution.MavenSession.lookupMap(MavenSession.java:486)
    at io.repaint.maven.tiles.TilesMavenLifecycleParticipant.afterProjectsRead(TilesMavenLifecycleParticipant.groovy:311)
    at org.apache.maven.DefaultMaven.callListeners(DefaultMaven.java:377)
    at org.apache.maven.DefaultMaven.afterProjectsRead(DefaultMaven.java:359)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:269)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:225)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:149)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:981)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:291)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:208)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke(Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)

@cstamas What's the best approach to handle this, so it'll work under Maven 3.9.9 and 4.0.0-beta4?

@cstamas
Copy link
Contributor

cstamas commented Sep 17, 2024

Moreover, all the lookup is deprecated as well (way way before Maven 3.9, since Maven 3.3.x?):
https://github.com/apache/maven/blob/maven-3.9.x/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java#L388-L411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants