我有一个由 maven-shade-plugin 构建的 jar。
它包含带有多个文件的 META-INF/services。
这些文件的名称错误(因为错误https://issues.apache.org/jira/browse/MSHADE-182 https://issues.apache.org/jira/browse/MSHADE-182)。
我想重命名这些文件。
使用 Maven 执行此操作的最简单方法是什么?
肮脏的黑客,但它对我有用
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<configuration>
<target>
<echo message="unjar" />
<unzip src="${project.build.directory}/${artifactId}-${version}.jar" dest="${project.build.directory}/unpacked/" />
<echo message="rename service providers in META-INF/services" />
<move todir="${project.build.directory}/unpacked/META-INF/services" includeemptydirs="false">
<fileset dir="${project.build.directory}/unpacked/META-INF/services"/>
<mapper type="glob" from="*" to="${shade.package}.*"/>
</move>
<echo message="jar back" />
<jar destfile="${project.build.directory}/${artifactId}-${version}.jar" basedir="${project.build.directory}/unpacked" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)