为什么m2e插件构建到maven jar项目的目标文件夹中的WEB-INF / classes?

时间:2016-11-10 13:41:33

标签: java eclipse maven m2eclipse m2e

由于我正在打包jar(即Maven jar项目),我不知道为什么m2e坚持将Eclipse项目的源文件夹输出设置为写入目标/ WEB-INF /类。我尝试将其更改为指向构建/类,但只要我执行Maven -> Update Project它就会将其更改回来。 为什么?我错过了项目级别设置吗?

更新:添加了pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>
    <parent>
        <groupId>com.mycompany.ta.wh</groupId>
        <artifactId>sales-master-pom</artifactId>
        <!-- <version>0.0.18</version> -->
        <version>[0.0.1,2.0.0)</version>
    </parent>
    <artifactId>amq2gcppubsub</artifactId>
    <version>0.1.33-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>Amq2GcpPubsub</name>
    <description>Subscribes to an ActiveMQ queue and publishes to a Google Cloud Platform Pubsub Topic.</description>
    <scm>
        <connection>scm:git:git://github.mycompany.com/DNA/amq2gcppubsub</connection>
        <developerConnection>scm:git:ssh://github.mycompany.com/DNA/amq2gcppubsub</developerConnection>
        <url>https://github.mycompany.com/DNA/amq2gcppubsub</url>
        <tag>HEAD</tag>
    </scm>

    <properties>
        <!-- DEPENDENCY VERSIONS -->
        <javabatch.version>3.1</javabatch.version>
        <activemq.version>5.8.0</activemq.version>
        <!--  Override master pom because conflicts with activemq's slf4j version -->
        <slf4j.api.version>1.6.6</slf4j.api.version> 
    </properties>
    <dependencies>
<!--        <dependency> -->
<!--            <groupId>org.slf4j</groupId> -->
<!--            <artifactId>slf4j-api</artifactId> -->
<!--            <version>1.6.6</version>  -->
<!--        </dependency> -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.6</version>
            <scope>test</scope>
        </dependency>

<!--        <dependency conf="runtime" org="org.slf4j" name="slf4j-log4j12" rev="1.7.6"> -->
<!--            <exclude module="log4j" /> -->
<!--        </dependency> -->


        <dependency>
            <groupId>com.mycompany.ta.aa</groupId>
            <artifactId>JavaBatch</artifactId>
            <version>${javabatch.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>4.3.3.RELEASE</version>
        </dependency>

        <dependency> <!-- Required by JavaBatch -->
            <groupId>com.mycompany.ss.sh</groupId>
            <artifactId>THDDAO_TaAaDistributedBatch</artifactId>
            <version>2.15</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.google.http-client</groupId>
            <artifactId>google-http-client</artifactId>
            <version>1.22.0</version>
        </dependency>

        <dependency>
            <groupId>com.google.http-client</groupId>
            <artifactId>google-http-client-jackson2</artifactId>
            <version>1.22.0</version>
        </dependency>

        <dependency>
            <groupId>com.google.oauth-client</groupId>
            <artifactId>google-oauth-client</artifactId>
            <version>1.22.0</version>
        </dependency>

        <dependency>
            <groupId>com.google.api-client</groupId>
            <artifactId>google-api-client</artifactId>
            <version>1.22.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.apis</groupId>
            <artifactId>google-api-services-pubsub</artifactId>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.mycompany.ta.aa</groupId>
            <artifactId>THDDAO</artifactId>
            <version>2.17</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-client</artifactId>
            <version>${activemq.version}</version>
        </dependency>
        <dependency>
            <groupId>com.mycompany.ta.aa</groupId>
            <artifactId>tomarch</artifactId>
            <version>3.3.27</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>

    </dependencies>

</project>

1 个答案:

答案 0 :(得分:1)

发生这种情况的原因是因为我有这个&#34; outputDirectory&#34;父pom的<build>部分中的标记。

<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes
</outputDirectory>

我删除后,Maven更新删除了&#34; WEB-INF&#34;来自.classpath输出目录。