为什么我eclipse新建项目的时候默认的是JRE1.5

tonghuazhong 发布于 2012/07/28 22:57
阅读 11K+
收藏 0

前提,我的eclipse里面的Installed JREs已经设置成jdk 1.6的了而且已经打钩了。

如果我新建普通的java项目的时候还可以通过选择来选择使用版本,但是提供的是J2SE-1.6这个不是我配置的啊,我只能选择默认的,如图:

当我新建maven工程的时候问题就大了,没法选择,新建后结果如下图:

各位高手帮忙解决啊,@红薯 大哥帮忙解决啊

1.能让新建新建的maven默认是当前的jdk1.6.0_26?

2.另外那个J2SE-1.5是从哪里冒出来的求解释?

加载中
1
dick86114
dick86114
楼主你解决了吗?我找到一个地址,证实可用,希望大家都能看到,参考 http://hi.baidu.com/hi_hi/item/765ec8bbc49880d384dd79d1
tonghuazhong
tonghuazhong
谢谢
1
Day
Day
maven的原因,建项目选的archetype里配置是1.5的
0
tonghuazhong
tonghuazhong
虽然每次可以改,但是太麻烦。我想应该有地方可以设置这个
0
丑丑泡泡猴
丑丑泡泡猴

引用来自“Day”的答案

maven的原因,建项目选的archetype里配置是1.5的
那如何修改这个archetype里的配置,改成1.6呢?
Day
Day
archetype我还不知道怎么改,所以我一般是当期项目里把引用才成1.6
0
Dr_Eagle
Dr_Eagle

把不要的版本Remove掉

0
江右没蓝_
江右没蓝_
改maven当中的settings.xml下次再建一个新的maven project就可以了
0
冰小块
冰小块

修改Maven中conf目录里的setting.xml文件内容,加上如下内容:

<profiles>
		<!-- profile | Specifies a set of introductions to the build process, to 
			be activated using one or more of the | mechanisms described above. For inheritance 
			purposes, and to activate profiles via <activatedProfiles/> | or the command 
			line, profiles have to have an ID that is unique. | | An encouraged best 
			practice for profile identification is to use a consistent naming convention 
			| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 
			'user-brett', etc. | This will make it more intuitive to understand what 
			the set of introduced profiles is attempting | to accomplish, particularly 
			when you only have a list of profile id's for debug. | | This profile example 
			uses the JDK version to trigger activation, and provides a JDK-specific repo. -->
		<profile>
			<id>jdk-1.8</id>
			<activation>
				<activeByDefault>true</activeByDefault>
				<jdk>1.8</jdk>
			</activation>
			<properties>  
				<maven.compiler.source>1.8</maven.compiler.source>  
				<maven.compiler.target>1.8</maven.compiler.target>  
				<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>  
			</properties>
			<repositories>
				<repository>
					<id>nexus</id>
					<name>local private nexus</name>
					<url>http://maven.oschina.net/content/groups/public/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</repository>
			</repositories>
			<pluginRepositories>
				<pluginRepository>
					<id>nexus</id>
					<name>local private nexus</name>
					<url>http://maven.oschina.net/content/groups/public/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</pluginRepository>
			</pluginRepositories>
		</profile>


		<!-- | Here is another profile, activated by the system property 'target-env' 
			with a value of 'dev', | which provides a specific path to the Tomcat instance. 
			To use this, your plugin configuration | might hypothetically look like: 
			| | ... | <plugin> | <groupId>org.myco.myplugins</groupId> | <artifactId>myplugin</artifactId> 
			| | <configuration> | <tomcatLocation>${tomcatPath}</tomcatLocation> | </configuration> 
			| </plugin> | ... | | NOTE: If you just wanted to inject this configuration 
			whenever someone set 'target-env' to | anything, you could just leave off 
			the <value/> inside the activation-property. | <profile> <id>env-dev</id> 
			<activation> <property> <name>target-env</name> <value>dev</value> </property> 
			</activation> <properties> <tomcatPath>/path/to/tomcat/instance</tomcatPath> 
			</properties> </profile> -->
	</profiles>



其中的1.8修改为你需要的jdk版本号,然后在eclipse里的项目右击鼠标-Maven-select Maven profiles,选择对应的jdk参数,然后更新项目就可以了

返回顶部
顶部