Include xml files in maven project

为君一笑 提交于 2019-11-28 11:51:26

I faced the same issue, I wanted to keep fxml & java files in the same folder (I'm using scenebuilder who needs both fxml and java files at the same place).

Here is my solution in pom.xml:

<resources>
    <resource>
        <directory>src/main/resources</directory>
    </resource>
    <resource>
        <directory>src/main/java</directory>
        <includes>
          <include>**/*.fxml</include>
        </includes>
  </resource>        
</resources>    

If you want the xml files to be included in your JAR file, then store them in the resources folder, instead of java.

Presumably they're in src/main/java. Try moving them to src/main/resources. Anything in src/main/resources will be packaged into the JAR file along with the .class files.

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