gpt4 book ai didi

java - Maven 不断搞乱我的 Java 编译器和构建路径设置

转载 作者:搜寻专家 更新时间:2023-11-01 01:44:00 24 4
gpt4 key购买 nike

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

我认为这与更新项目设置复选框有关。但是我在我的 pom 中找不到负责配置我的 eclipse 项目的标签。有什么提示吗?

顺便说一句,我不能只取消选中该框,因为 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>

最佳答案

我不太确定你的问题,但我相信 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

关于java - Maven 不断搞乱我的 Java 编译器和构建路径设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17480545/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com