我想从依赖jar中添加资源,它位于 在mvn包目标期间, myjar.jar:META_INF / public-resource / myresource.sk 到我的 webapp / WEB-INF / myfolder 。有人可以提供建议,怎么做?
答案 0 :(得分:5)
如果myjar在mvn存储库中,就像它应该的那样,像
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>mygroupid</groupId>
<artifactId>myjar</artifactId>
<outputDirectory>src/main/webapp/WEB-INF/myfolder</outputDirectory>
<includes>META_INF/public-resource/myresource.sk</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>