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";>
>         <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
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to