Include maven version in artifact name
Hi,
I'm trying to configure Intellij for a simple maven project that builds a JAR. My goal is to have the Intellij build produce an essentially identical result to the mvn command line build, but I'd like to avoid delegating to maven for all the Intellij actions - both because it's slow and because it doesn't integrate as well with the rest of the IDE.
I've basically managed to do this, but there's one thing that's stumping me. I can't make Intellij include a configurable version number in the jar name. Ideally I'd like to have it pull the version number from the maven properties, or another properties source that can be shared with the maven command line build. Removing the version number from the maven build to make them match is not an acceptable solution - I want to use the proper versioned jars.
Thanks in advance for any suggestions,
Please sign in to leave a comment.
How do you configure it for the command line Maven build?
The maven build is just doing the default that comes with maven - i.e. packaging: jar and a "finalName" of "${project.artifactId}-${project.version}"
this gives a jar name of e.g. myProject-1.0.0-SNAPSHOT.jar
You should configure the name via Maven as IDE takes the configuration from pom.xml file for the artifact name.
I think the root of the problem here is that I had to create the artifact configuration manually. Is there a way to have Intellij automatically generate the artifact configuration from the maven pom.xml? I've tried deleting the artifact configuration and re-importing the maven project but that didn't seem to do anything.
Ah I see. Indeed, there is no support for auto-creating artifacts configuration for Maven jar projects: https://youtrack.jetbrains.com/issue/IDEA-65911
And there are no means for automatically taking Maven version for naming the artifact created in IDE manually.
That's frustrating. Thanks for the answer. That ticket has been open for 8 years now; I guess the chances of it being implemented are... limited?
Unfortunately there are no plans for it in the nearest time.