Maven: add resource from jar to WEB-INF during build

前端 未结 1 1976
-上瘾入骨i
-上瘾入骨i 2021-01-15 13:00

I want to add resource from dependency jar, which resides in myjar.jar:META_INF/public-resource/myresource.sk to my webapp/WEB-INF/myfolder

相关标签:
1条回答
  • 2021-01-15 13:24

    If myjar is in mvn repository, like it should be, something like

    <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>
    
    0 讨论(0)
提交回复
热议问题