Maven Update在战争打包时更改.classpath失败的构建

时间:2013-11-25 02:49:56

标签: maven tomcat deployment war

我有一个将在Tomcat中部署的Spring Maven webapp项目。

我想将我的项目打包到.war,我的POM.xml如下所示。

<!-- Other settings -->    

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.4</version>
        </plugin>
    </plugins>
</build>

<!-- other settings -->

使用此设置,当我执行 Maven - &gt;从m2eclipse更新运行为 - &gt;在服务器上运行,它为ClassNotFoundException提供了ContextLoaderListener

但是,如https://stackoverflow.com/a/15780350/1433665中所述,当我从项目属性中Maven Dependencies添加Deployment Assembly到我的java构建路径时,项目运行正常。但是,当我执行 Maven Update 时,同样的问题仍然存在。

如何配置pom.xml,以便每次Deployment Assembly时都不必编辑Maven -> Update设置?

此外,只有在 Maven之后更改的文件 - &gt;更新.classpath,其中

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">

    <attributes>
        <attribute name="maven.pomderived" value="true"/>
        <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
    </attributes>
</classpathentry>

更新为

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">

    <attributes>
        <attribute name="maven.pomderived" value="true"/>
    </attributes>
</classpathentry>

0 个答案:

没有答案
相关问题