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

localRepository deprecated in Maven 3.9.1 #264

Closed
garretwilson opened this issue Apr 14, 2023 · 12 comments · Fixed by #265
Closed

localRepository deprecated in Maven 3.9.1 #264

garretwilson opened this issue Apr 14, 2023 · 12 comments · Fixed by #265

Comments

@garretwilson
Copy link

garretwilson commented Apr 14, 2023

On Windows 10 I just upgraded to Maven 3.9.1 and my builds that include launch4j:2.1.3:launch4j are now showing:

[WARNING] Parameter 'localRepository' is deprecated core expression; Avoid use of ArtifactRepository type. If you need access to local repository, switch to '${repositorySystemSession}' expression and get LRM from it instead.

(I have the Launch4J Maven Plugin defined in a parent project but only enabled under certain conditions, so basically I now get this warning all over the place even if the Launch4J Maven Plugin isn't being used in a project, because it is still referenced just not enabled.)

The warning speaks for itself. This seems to be from MNG-7706, implemented in apache/maven#1012. It's also listed in the v3.9.1 deprecation list.

Hopefully this is some easy change to make to update to the latest approach for getting some value? I think there are more technical details in the ticket MNG-7706 (which I haven't had a chance to read thoroughly yet).

@lukaszlenart
Copy link
Collaborator

Thanks for pointing this out, yet it's not that easy ;-) I was able to switch to the new APIs in the plugin, but when I tried to use it with my example app I've got

[ERROR] Failed to execute goal com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:2.4.0-SNAPSHOT:launch4j (l4j-clui) on project launch4j-demo: A type incompatibility occurred while executing com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:2.4.0-SNAPSHOT:launch4j: org.apache.maven.artifact.DefaultArtifact cannot be cast to org.eclipse.aether.artifact.Artifact

and have no idea what's wrong :(

@akuhtz
Copy link
Contributor

akuhtz commented Apr 15, 2023

@lukaszlenart Do you have a WIP PR with the changes you did already?
Maybe the changes to fix flatten-maven-plugin could help: mojohaus/flatten-maven-plugin#336

@lukaszlenart
Copy link
Collaborator

@akuhtz I pushed a SNAPSHOT version into OSS - 2.4.0-SNAPSHOT, just configure the repo:

    <pluginRepositories>
        <pluginRepository>
            <id>oss-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <layout>default</layout>
            <name>OSS Sonatype Snapshots</name>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

@lukaszlenart
Copy link
Collaborator

lukaszlenart commented Apr 16, 2023

Right now I get

[ERROR] Failed to execute goal com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:2.4.0-SNAPSHOT:launch4j (l4j-clui) on project launch4j-demo: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact net.sf.launch4j:launch4j:jar:3.50:workdir-mac

@akuhtz
Copy link
Contributor

akuhtz commented Apr 18, 2023

@lukaszlenart I hope I fixed it with #271 . Can you try on your side?

@lukaszlenart
Copy link
Collaborator

This time

[ERROR] Failed to execute goal com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:2.4.0-SNAPSHOT:launch4j (l4j-clui) on project launch4j-demo: Execution l4j-clui of goal com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:2.4.0-SNAPSHOT:launch4j failed: An API incompatibility was encountered while executing com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:2.4.0-SNAPSHOT:launch4j: java.lang.NoSuchMethodError: org.eclipse.aether.resolution.ArtifactResult.getLocalArtifactResult()Lorg/eclipse/aether/repository/LocalArtifactResult;

but I think I know what's wrong

@akuhtz
Copy link
Contributor

akuhtz commented Apr 18, 2023

#272 let's the build pass with maven-3.8.8 and 3.9.1

@lukaszlenart
Copy link
Collaborator

Thanks a lot @akuhtz ! It works, pushed a new SNAPSHOT into OSS, please double check and I will prepare a new release :)

@akuhtz
Copy link
Contributor

akuhtz commented Apr 19, 2023

@lukaszlenart It works for me, too 👍

@lukaszlenart
Copy link
Collaborator

Cool, could you approve the PR?

@akuhtz
Copy link
Contributor

akuhtz commented Apr 19, 2023

Done.

@garretwilson
Copy link
Author

I wanted to swing back and say thank you all for responding an addressing this so quickly. I got sidetracked with some other bugs with unrelated plugins, but now I've got a chance to upgrade this plugin and it looks like it fixed the issue.

Great work. Much appreciated!

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

Successfully merging a pull request may close this issue.

3 participants