Maven不断弄乱我的java编译器并构建路径设置

时间:2013-07-05 03:12:19

标签: java eclipse maven m2e

会发生什么:我的java编译器设置从我的自定义jdk重置为默认java se1.5
当它hapens:每次我点击maven-更新项目(当然在日食)。

我认为它与更新项目设置复选框有关。但我无法在我的pom中找到负责配置我的eclipse项目的标签。任何提示?

BTW我不能只取消选中该框,因为pom可能有其他对我的项目至关重要的设置

编辑:抱歉延迟,这是我的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/maven-v4_0_0.xsd">
<!--    <parent> -->
<!--        <groupId>org.geomajas</groupId> -->
<!--        <artifactId>geomajas-parent</artifactId> -->
<!--        <version>1.0.9</version> -->
<!--    </parent> -->
    <modelVersion>4.0.0</modelVersion>
    <groupId>ne</groupId>
    <artifactId>projl</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>TApp</name>
    <description>Test</description>
    <url>http://www.example.com/</url>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.geomajas</groupId>
                <artifactId>geomajas-backend</artifactId>
                <version>1.13.0-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.geomajas</groupId>
                <artifactId>geomajas-face-puregwt</artifactId>
                <version>1.0.0-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.geomajas.plugin</groupId>
                <artifactId>geomajas-plugin-geotools-all</artifactId>
                <version>1.10.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.geomajas.plugin</groupId>
                <artifactId>geomajas-plugin-rasterizing-all</artifactId>
                <version>1.2.0-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.geomajas.plugin</groupId>
                <artifactId>geomajas-widget-puregwt-core-all</artifactId>
                <version>1.0.0-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.geomajas</groupId>
                <artifactId>geomajas-dep</artifactId>
                <version>1.12.28</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.9.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <scope>compile</scope>
        </dependency>

        <!-- Geomajas dependencies -->
        <dependency>
            <groupId>org.geomajas.plugin</groupId>
            <artifactId>geomajas-plugin-rasterizing</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geomajas</groupId>
            <artifactId>geomajas-puregwt-client-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geomajas</groupId>
            <artifactId>geomajas-testdata</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geomajas.plugin</groupId>
            <artifactId>geomajas-layer-geotools</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geomajas.plugin</groupId>
            <artifactId>geomajas-layer-openstreetmap</artifactId>
        </dependency>
        <dependency>
            <groupId>org.geomajas.plugin</groupId>
            <artifactId>geomajas-layer-wms</artifactId>
        </dependency>



        <!-- Google dependencies -->
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwt-version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>${gwt-version}</version>
            <scope>runtime</scope>
        </dependency>

        <!-- External GWT libraries -->
        <dependency>
            <groupId>com.google.code.gwt-dnd</groupId>
            <artifactId>gwt-dnd</artifactId>
            <version>3.1.0</version>
        </dependency>

        <!-- logging dependencies, delegate all to slf4j and use logback -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <!-- Run the application using "mvn jetty:run" -->
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.20</version>
                <configuration>
                    <webAppConfig>
                        <contextPath>/</contextPath>
                        <baseResource implementation="org.mortbay.resource.ResourceCollection">
                            <!-- need both the webapp dir and location where GWT puts stuff -->
                            <resourcesAsCSV>${basedir}/src/main/webapp,${project.build.directory}/${project.build.finalName}</resourcesAsCSV>
                        </baseResource>
                    </webAppConfig>
                    <reload>manual</reload>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.5.0</version>
                <dependencies>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-user</artifactId>
                        <version>${gwt-version}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-dev</artifactId>
                        <version>${gwt-version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <module>the.proj.App</module>
                    <runTarget>index.html</runTarget>
                    <disableCastChecking>true</disableCastChecking>
                    <disableClassMetadata>true</disableClassMetadata>
                    <extraJvmArgs>-Xmx1024M -Xss1024k</extraJvmArgs>
                    <hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
                    <copyWebapp>true</copyWebapp>
                </configuration>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.2.1</version>

                <configuration>

                    <!-- Container configuration -->
                    <container>
                        <containerId>tomcat7x</containerId>
                        <type>remote</type>
                    </container>

                    <!-- Configuration to use with the container -->
                    <configuration>
                        <type>runtime</type>
                        <properties>
                            <cargo.remote.username>${dev.deploy.username}</cargo.remote.username>
                            <cargo.remote.password>${dev.deploy.password}</cargo.remote.password>
                            <cargo.remote.uri>${dev.deploy.uri}</cargo.remote.uri>
                        </properties>
                    </configuration>
                    <deployer>
                        <deployables>
                            <deployable>
                                <groupId>org.geomajas</groupId>
                                <artifactId>geomajas-puregwt-showcase</artifactId>
                                <type>war</type>
                                <properties>
                                    <context>showcase-pure-trunk</context>
                                </properties>
                            </deployable>
                        </deployables>
                    </deployer>

                </configuration>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <!-- m2eclipse with embedded jetty -->
        <profile>
            <id>m2e</id>
            <activation>
                <property>
                    <name>m2e.version</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.geomajas</groupId>
                    <artifactId>geomajas-jetty-runner</artifactId>
                    <version>1.0.0</version>
                </dependency>
                <dependency>
                    <groupId>com.google.gwt</groupId>
                    <artifactId>gwt-dev</artifactId>
                    <version>${gwt-version}</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <properties>
                <gwt.compiler.skip>true</gwt.compiler.skip>
            </properties>
        </profile>
        <profile>
            <id>skipGwt</id>
            <activation>
                <property>
                    <name>skipGwt</name>
                </property>
            </activation>
            <properties>
                <gwt.compiler.skip>true</gwt.compiler.skip>
            </properties>
        </profile>

        <profile>
            <id>selenium-tests</id>
            <activation>
                <property>
                    <name>!skipSelenium</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <!-- Run the application using "mvn jetty:run" -->
                    <plugin>
                        <groupId>org.mortbay.jetty</groupId>
                        <artifactId>maven-jetty-plugin</artifactId>
                        <configuration>
                            <webAppConfig>
                                <contextPath>/</contextPath>
                            </webAppConfig>
                            <reload>manual</reload>
                            <stopPort>9966</stopPort>
                            <stopKey>stop-jetty</stopKey>
                        </configuration>
                        <executions>
                            <execution>
                                <id>start-jetty</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <daemon>true</daemon>
                                    <scanIntervalSeconds>5</scanIntervalSeconds>
                                    <connectors>
                                        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                                            <port>9080</port>
                                            <maxIdleTime>60000</maxIdleTime>
                                        </connector>
                                    </connectors>
                                </configuration>
                            </execution>
                            <execution>
                                <id>stop-jetty</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <includes>
                                        <include>**/*TestInt.java</include>
                                        <include>**/IntTest*.java</include>
                                    </includes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

<repositories>
        <repository>
            <id>Geomajas</id>
            <name>Geomajas repository</name>
            <url>http://maven.geomajas.org/</url>
        </repository>

        <!-- uncomment if you want to use Geomajas snapshots, comment for faster builds -->

        <repository>
            <id>Geomajas-latest</id>
            <name>Geomajas snapshot repository</name>
            <url>http://apps.geomajas.org/nexus/content/groups/latest</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>Geomajas</id>
            <name>Geomajas repository</name>
            <url>http://maven.geomajas.org/</url>
        </pluginRepository>
    </pluginRepositories>

    <properties>
        <gwt-version>2.5.1</gwt-version>
        <gwt.compiler.skip>false</gwt.compiler.skip>
    </properties>

</project>

1 个答案:

答案 0 :(得分:8)

我不太确定你的问题,但我相信m2e插件通过设置编译器插件获得源/输出版本。

在您的POM中,有类似

的内容
....
<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <configuration>
        <source>1.6</source>
        <target>1.6</target>
      </configuration>
    </plugin>
      .....
  </plugins>
</build>

m2e应该能够根据源版本和目标版本

配置Eclipse