【问题标题】:Maven resource plugin expose an image from a different pathMaven 资源插件从不同的路径公开图像
【发布时间】:2015-12-18 14:51:02
【问题描述】:

我有一个可从 /resources/gfx/loading.gif

访问的图像

我想让它从 /img/immage.gif

访问

我尝试使用 ma​​ven-resources-plugin 进行以下配置,但实际上什么也没发生。

我目前正在从 Eclipse 构建应用程序。

 <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.6</version>
        <executions>
            <execution>
                <id>copy-loading-status</id>
                <phase>package</phase>
                <goals>
                    <goal>copy-resources</goal>
                </goals>
                <configuration>
                    <outputDirectory>/src/main/webapp/img</outputDirectory>
                    <resources>
                        <resource>
                            <directory>/src/main/resources/gfx</directory>
                            <includes>
                                <include>loading.gif</include>
                            </includes>
                        </resource>
                    </resources>
                </configuration>
            </execution>
        </executions>
    </plugin>

【问题讨论】:

    标签: maven maven-resources-plugin


    【解决方案1】:

    假设您正在构建一个 WAR,您可以配置 maven-war-plugin 以包含其他 Web 资源:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.6</version>
        <configuration>
            <webResources>
                <resource>
                    <directory>/src/main/resources/gfx</directory>
                    <includes>
                        <include>loading.gif</include>
                    </includes>
                    <targetPath>img</targetPath>
                </resource>
            </webResources>
        </configuration>
    </plugin>
    

    【讨论】:

    • tnx for this 会尝试并告诉你,如果有效我会接受答案
    猜你喜欢
    • 1970-01-01
    • 2012-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多