Quantcast
Channel: Gik's notes » ant
Viewing all articles
Browse latest Browse all 4

Adding manifest attributes to existing JAR file

$
0
0

jar
To modify manifest in external existing JAR file in JAVA do:

<build>
    <plugins>
    ...
    
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <execution>
                    <id>repack</id>
                    <phase>package</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target>
                            <jar update="true" 
                                 file="${project.basedir}/some.jar">
                                <manifest>
                                    <attribute name="Class-Path" 
                                               value="jackson.jar"/>
                                </manifest>
                            </jar>
                        </target>
                    </configuration>
                </execution>
            </executions>
        </plugin>    
    
    </plugins>
</build>

Thanx to http://stackoverflow.com/a/20634999

Docs:
https://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html
http://www.softlab.ntua.gr/facilities/documentation/unix/java/tutorial/jar/basics/mod.html
http://introcs.cs.princeton.edu/java/85application/jar/jar.html

The bad idea is to compress JAR file with ZIP: http://stackoverflow.com/a/7085511


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images