使用资源排除时,不复制application.yml

时间:2017-08-28 20:21:11

标签: maven spring-boot

我在Spring Boot对象中使用以下构建设置:

<build>
    <resources>
        <resource>
            <directory>src/main/resources/clientApp</directory>
            <excludes>
                <exclude>node_modules/**</exclude>
            </excludes>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

包含node.js应用程序的整个clientApp目录已正确复制,没有不需要的node_modules目录。作为不必要的副作用,不再复制application.properties/.yml文件。

我如何才能获取node_modules目录,而且application.yml会被复制?

1 个答案:

答案 0 :(得分:1)

您可以为include

指定application.properties|yaml
<build>
    <resources>
        <resource>
            <directory>src/main/resources/clientApp</directory>
            <includes>
                <include>node_modules/application.*</include>
            </includes>
            <excludes>
                <exclude>node_modules/**</exclude>
            </excludes>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

或者,您可以考虑将application.properties|yamlsrc/main/resources/clientApp/node_modules移至src/main/resources/clientApp