As you didn't post a complete log or pom.xml (i.e. no properties, or or artifact metadata (group, artifactId, version, etc). We don't know what phase or goal you're executing, etc. With what you provided it's difficult to discern what's going on.
Maven Assembly Plugin assembles new artifacts... it's going to copy from your .m2 to a representative location specified in your assembly descriptor. It won't rename unless you explicity tell it to. You're doing some renaming, but that's inside the artifact you're creating. I can only assume what's going on without seeing the rest of your POM, assembly descriptor, and log. You have things like this in your descriptor... <file> <source>target/${artifactId}-${version}.${packaging}</source> <outputDirectory>/</outputDirectory> <destName>${artifactId}.${packaging}</destName> </file> Note artifactID, version, packaging are going to be inherited from the POM, they going to resolve from your descriptor. This all can have some strange side effects because it looks like you're trying to include yourself but then rename yourself to something different inside an artifact you're creating. To a certain extent this looks a bit bizzare. Without any other information on hand, the only think I can suggest is try changing the setting for appendAssemblyId from false to true; then rerun and inspect the log... what does the log say it's "renaming" it to? My suspicion is that you'll see: [DEBUG] Adding artifact: com.example:MyArtifact:jar:8.0.0 with file: /Users/me/.m2/repository/com/example/MyArtifact/8.0.2/MyArtifact-8.0.2.jar to assembly location: lib/MyArtifact-bin-8.0.0.jar. [DEBUG] Adding file: /Users/me/.m2/repository/com/example/MyArtifact/8.0.2/MyArtifact-8.0.2.jar to archive location: Project/lib/MyArtifact-bin-8.0.0.jar Before anyone can really help you futher, I'd say you need to provide more complete information; redacted where appropriate, but it really needs to be complete. - JK On 12/15/17, 10:18 AM, "Wilson, Sam" <sawil...@akamai.com> wrote: Hey James, The way you interpreted the version range is indeed what I intended (we use semantic versioning.) It is definitely renaming the jar. I checked the shasums of MyArtifact-8.0.2.jar and the file included in the archive, and they match, even though the file is named MyArtifact-8.0.0.jar. The MANIFEST contains “lib/MyArtifact-8.0.2.jar” as an entry. Why would it be named MyArtifact-bin-8.0.0.jar ever? I can try to create a minimal repro, but it’ll be hard because this is a big project with lots of parts. Sam From: James Klo <jim....@sri.com> Reply-To: Maven Users List <users@maven.apache.org> Date: Friday, December 15, 2017 at 12:27 PM To: Maven Users List <users@maven.apache.org> Subject: Re: Maven Assembly Plugin renaming jar From the small snippet of log, it's bit confusing, because it looks like the artifact you are assembling is named the same as the dependency you are pulling in. Because you have this setting in the maven-assembly-plugin: <appendAssemblyId> false </appendAssemblyId> The generated Artifact is being named: MyArtifact-8.0.0.jar Instead of being named: MyArtifact-bin-8.0.0.jar Additionally, look at version range declaration for MyArtifact... <version>[8.0.0-SNAPSHOT,9.0.0-SNAPSHOT)</version> Per this enforcer docs: https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html I would read your requirement as 8.0.0-SNAPSHOT >= X < 9.0.0-SNAPSHOT So it's not renaming your jar, it is fetching the most current version of the dependent artifact defined for that range and adding it into your current project assembly which just so happens to now have the same name AND a similar version number. Jim Klo Senior Software Engineer Center for Software Engineering SRI International t. @nsomnac On 12/15/17, 8:51 AM, "Wilson, Sam" <sawil...@akamai.com<mailto:sawil...@akamai.com>> wrote: Sorry to bump and old thread, but I’d appreciate it if someone had any insight. Sam From: Sam Wilson <sawil...@akamai.com<mailto:sawil...@akamai.com>> Reply-To: Maven Users List <users@maven.apache.org<mailto:users@maven.apache.org>> Date: Friday, November 24, 2017 at 11:12 AM To: "users@maven.apache.org<mailto:users@maven.apache.org>" <users@maven.apache.org<mailto:users@maven.apache.org>> Subject: Re: Maven Assembly Plugin renaming jar Oh, I should mention that I've tried this with maven-assembly-plugin 2.4 and 3.1.0. Sam On 11/24/2017 11:07 AM, Wilson, Sam wrote: Hey! Hopefully you can help me out. Maven assembly plugin seems to be renaming a jar file without being told to, and it’s messing up my MANIFEST.MF classpath. You notice in the snippet of mvn -X below the assembly plugin seems to be getting version 8.0.2, but it renames it to 8.0.0. Thanks, Sam --- mvn -X package -- […] [DEBUG] Adding dependency artifact com.example:MyArtifact:jar:8.0.0. [DEBUG] Adding artifact: com.example:MyArtifact:jar:8.0.0 with file: /Users/me/.m2/repository/com/example/MyArtifact/8.0.2/MyArtifact-8.0.2.jar to assembly location: lib/MyArtifact-8.0.0.jar. [DEBUG] Adding file: /Users/me/.m2/repository/com/example/MyArtifact/8.0.2/MyArtifact-8.0.2.jar to archive location: Project/lib/MyArtifact-8.0.0.jar […] --- Project/pom.xml --- <project> <!-- ... --> <dependencies> <!-- ... --> <dependency> <groupId>com.example</groupId> <artifactId>MyArtifact</artifactId> <version>[8.0.0-SNAPSHOT,9.0.0-SNAPSHOT)</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <classpathPrefix>lib/</classpathPrefix> <mainClass>com.example.MainClass</mainClass> </manifest> </archive> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.2</version> <executions> <execution> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <finalName> ${project.artifactId} </finalName> <appendAssemblyId> false </appendAssemblyId> <descriptors> <descriptor>src/assembly/bin.xml</descriptor> </descriptors> <attach>false</attach> </configuration> </execution> </executions> </plugin> </project> --- Project/src/assembly/bin.xml --- <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"<http://maven.apache.org/xsd/assembly-1.1.0.xsd%22><http://maven.apache.org/xsd/assembly-1.1.0.xsd%22%3chttp:/maven.apache.org/xsd/assembly-1.1.0.xsd%22%3e>> <id>bin</id> <baseDirectory>${artifactId}</baseDirectory> <formats> <format>tar.gz</format> <format>dir</format> </formats> <dependencySets> <dependencySet> <useProjectArtifact>false</useProjectArtifact> <unpack>false</unpack> <scope>runtime</scope> <outputDirectory>lib</outputDirectory> </dependencySet> </dependencySets> <files> <file> <source>target/${artifactId}-${version}.${packaging}</source> <outputDirectory>/</outputDirectory> <destName>${artifactId}.${packaging}</destName> </file> <file> <source>src/main/resources/ProjectConfiguration.properties</source> <destName>${artifactId}.properties</destName> <outputDirectory>/</outputDirectory> </file> <file> <source>log4j2.xml</source> <outputDirectory>/</outputDirectory> </file> </files> </assembly> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org<mailto:users-unsubscr...@maven.apache.org><mailto:users-unsubscr...@maven.apache.org> For additional commands, e-mail: users-h...@maven.apache.org<mailto:users-h...@maven.apache.org><mailto:users-h...@maven.apache.org>
smime.p7s
Description: S/MIME cryptographic signature