Maven *.xml资源在构建后未更新



我最近发现,我在文件中所做的一些更改并没有反映在target war中——只有当我没有对java代码进行任何更改时才会发生这种情况,因此省略了编译阶段。是否有比无意义的代码更改(如重命名变量)更好的强制编译方法,或者是否有更新*.xml内容的方法?

编辑:这是我的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>hiring</artifactId>
  <version>1.0</version>
  <packaging>war</packaging>
  <dependencies>
    <dependency>
      <groupId>org.camunda.bpm</groupId>
      <artifactId>camunda-engine</artifactId>
      <version>7.0.0-Final</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.0.1</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>
        <configuration>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <repositories>
    <repository>
      <id>camunda-bpm-nexus</id>
      <name>camunda-bpm-nexus</name>
      <url>https://app.camunda.com/nexus/content/groups/public</url>
    </repository>
  </repositories>
</project>

所有xml文件位于src/main/resources

我正在使用Eclipse Keppler Service Release 1 with Maven 3.2.1, Java 1.7.0_17

  1. 确保你已经安装了m2e/m2e-wtp
  2. 确保Eclipse将Maven项目属性应用到项目中-右键单击project> Configure> Convert to Maven project。
  3. 如果您在Eclipse之外编辑文件,请确保Eclipse知道更改——您需要启用本机钩子——Preferences> General> Workspace> Refresh using native hooks or polling。或者,您可以选择该文件并按F5(刷新)以确保Eclipse知道更改。
  4. 如果您使用WST/JST(服务器工具)并通过Eclipse部署到服务器,请点击发布。

根据我的经验,如果你完成了所有这些,它应该会像预期的那样将更改发布到你的目标war。但是,如果XML文件被用作启动配置的一部分,则可能需要重新启动容器。

最新更新