Include xml files in maven project

前端 未结 2 953
醉话见心
醉话见心 2020-12-18 14:37

I have a maven pom file to build from a structure like:

package1
--1.java
--2.java
--packageMetaInfo.xml

package2
--21.java
--22.java

相关标签:
2条回答
  • 2020-12-18 15:29

    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.

    0 讨论(0)
  • 2020-12-18 15:32

    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>    
    
    0 讨论(0)
提交回复
热议问题