With maven - clean package, xml source files are not included in classpath

后端 未结 2 1800
轻奢々
轻奢々 2020-12-10 01:36

So it seems that Maven package is setup by default to compile but not copy xml files in the java classpath, unless they\'re already there. In Eclipse, I created the simplest

2条回答
  •  时光取名叫无心
    2020-12-10 02:14

    The xml file shouldn't be placed in src/main/java but in src/main/resources instead. Maven will only compile java sources in src/main/java and will ignore everything else in there by default.

    If you want to keep the XML in src/main/java, you can add it in the resource section of the POM. I would recommend against this, try to keep non-java files that you want in the artifact in src/main/resources.

提交回复
热议问题