web-dev-qa-db-ja.com

Maven-ビルドからフォルダーを除外する

ビルドからフォルダーsrc/main/resources/scripts/を除外しようとしていますが、以下は機能しません。

<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <excludes>
                <exclude>src/main/resources/scripts/</exclude>
            </excludes>
        </resource>
    </resources>

    <plugins>
        <plugin>
            <groupId>org.Apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <excludes>
                    <exclude>src/main/resources/scripts/</exclude>
                </excludes>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

何か案は?

29
Cheetah

代わりに試してください:

<exclude>scripts/**</exclude>

除外はディレクトリに基づいているため、構築は除外されます

src/main/resources/src/main/resources/scripts
50
Robert Scholte

同様の問題があり、次の問題が見つかりました。

例えば:

<profiles>
    <profile>
        <id>myId</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.Apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration combine.self="override">
                        <excludes>
                            <exclude>**/some/full/directory/*</exclude>
                            <exclude>**/some/single/File.Java</exclude>
                        </excludes>
                    </configuration>
                </plugin>
            </plugins>
        </build>
</profile>
5
codemonkey
<profiles>
    <profile>
        <id>readBuild</id>
        <build>
             <plugins>
            <plugin>
                <groupId>org.Apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration >
                    <excludes>
                        <exclude>**/com/pyramid/controllers/EntitlementWriteController.Java</exclude>
                        <exclude>**/com/pyramid/controllers/ProductWriteController.Java</exclude>
                    </excludes>
                     <testExcludes>
                      <testExclude>**/com/pyramid/controllers/EntitlementWriteControllerTest.Java</testExclude>
                       <testExclude>**/com/pyramid/controllers/ProductWriteControllerTest.Java</testExclude>
                    </testExcludes>
                </configuration>
            </plugin>
        </plugins>
            <directory>yourDirectory</directory>
        </build>
    </profile>
2
kumar