批量更新MANIFEST.MF为使用maven现有罐 [英] batch updating manifest.mf for existing jars using maven

查看:172
本文介绍了批量更新MANIFEST.MF为使用maven现有罐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加自定义键/值对现有的几种jar文件的MANIFEST.MF在我的战争项目(那些罐子不是项目依赖)。

I would like to add a custom key/value pair to the MANIFEST.MF of several existing jar files in my war project (those jars are not the project dependencies).

我已经可以包/改装使用Ant任务的罐子。

I already can pack/repack those jars using an ant task.

我读到清单的任务,我怎么能申请该任务到一个文件集(如果有一种方法)?先谢谢了。

I read about "manifest" task, how can I apply that task to a fileset (if there is a way)? Thanks in advance.

推荐答案

这是我第一次计算器答案。希望它适合你:)

This is my first answer at StackOverflow. Hope it suits you :)

我已经做了这样的:

<target name="xxx.modifyManifests">
    <echo message="Modifying jar manifests to add trusted-library" />
    <apply executable="jar">
        <arg value="umf" />
        <arg line="${xxx.resources}/manifest/custom_manifest.mf" />
        <srcfile />
        <fileset dir="${xxx.target}/applets" includes="*.jar" />
    </apply>
</target>

电话是一个简单的使用maven-antrun-插件:

The call is a simple one using maven-antrun-plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <id>xxx.modifyManifests</id>
            <phase>compile</phase>
            <configuration>
                <target>
                    <property environment="windows" />
                    <property name="xxx.resources"
                        value="${project.build.directory}/../src/main/resources" />
                    <property name="xxx.target"
                        value="${project.build.directory}/${project.artifactId}-${project.version}" />
                    <ant antfile="${basedir}/build.xml">
                        <target name="xxx.modifyManifests" />
                    </ant>
                </target>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

和我custom_manifest.mf是这样的:

And my custom_manifest.mf is like this:

Trusted-Only: true
Trusted-Library: true

这篇关于批量更新MANIFEST.MF为使用maven现有罐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆