Maven does not copy non-java files

梦想与她 提交于 2019-12-01 15:38:13
CoolBeans

If they are not java files you should move them to the src/main/resources and/or src/test/resources directory. That's the maven convention for storing the non java files.

Your other option is to use the maven-resources-plugin.

  <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.3</version>
        </plugin>
    </plugins>
    <resources>
        <resource>
        <directory>src/main/test</directory>
            <includes>
                <include> <the_files_you_want_to_include></include>
            </includes>
        </resource>
    </resources>

You have another option is to use the maven-antrun-plugin and execute an ant task to copy the files manually.

You can add src/main/test as a resource directory using the maven resources plugin. see http://maven.apache.org/plugins/maven-resources-plugin/examples/resource-directory.html for basic information and http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html for information on only including certain files (since you won't want to copy your .java files)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!