mvn 请使用 -source 7 或更高版本以启用 diamond 运算符

原创 2015年08月07日 16:54:30


mvn install -Dmaven.test.skip=true
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-p
rovider-api/2.9/wagon-provider-api-2.9.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-pr
ovider-api/2.9/wagon-provider-api-2.9.jar (53 KB at 14.5 KB/sec)
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
org.nlpcn:nlp-lang:jar:1.0.2
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-
plugin is missing. @ line 84, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten t
he stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support buildin
g such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building nlp-lang 1.0.2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ nlp-lang -
--
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 8 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ nlp-lang ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 58 source files to D:\code\nlp-lang-master\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/code/nlp-lang-master/src/main/java/org/nlpcn/commons/lang/dat/Double
ArrayTire.java:[77,13] -source 1.6 中不支持 try-with-resources
  (请使用 -source 7 或更高版本以启用 try-with-resources)
[ERROR] /D:/code/nlp-lang-master/src/main/java/org/nlpcn/commons/lang/dic/DicMan
ager.java:[14,78] -source 1.6 中不支持 diamond 运算符
  (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/code/nlp-lang-master/src/main/java/org/nlpcn/commons/lang/index/Memo
ryIndex.java:[17,65] -source 1.6 中不支持 diamond 运算符
  (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/code/nlp-lang-master/src/main/java/org/nlpcn/commons/lang/dat/DATMak
er.java:[52,58] -source 1.6 中不支持 diamond 运算符
  (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/code/nlp-lang-master/src/main/java/org/nlpcn/commons/lang/dat/DATMak
er.java:[267,13] -source 1.6 中不支持 try-with-resources
  (请使用 -source 7 或更高版本以启用 try-with-resources)
[ERROR] /D:/code/nlp-lang-master/src/main/java/org/nlpcn/commons/lang/occurrence
/Occurrence.java:[231,36] -source 1.6 中不支持 diamond 运算符
  (请使用 -source 7 或更高版本以启用 diamond 运算符)
[INFO] 6 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.872 s
[INFO] Finished at: 2015-08-07T16:45:14+08:00
[INFO] Final Memory: 15M/179M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.
3:compile (default-compile) on project nlp-lang: Compilation failure: Compilatio
n failure:
[ERROR] /D:/code/nlp-lang-master/src/main/java/org/nlpcn/commons/lang/dat/Double
ArrayTire.java:[77,13] -source 1.6 中不支持 try-with-resources
[ERROR] (请使用 -source 7 或更高版本以启用 try-with-resources)
[ERROR] /D:/code/nlp-lang-master/src/main/java/org/nlpcn/commons/lang/dic/DicMan
ager.java:[14,78] -source 1.6 中不支持 diamond 运算符
[ERROR] (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/code/nlp-lang-master/src/main/java/org/nlpcn/commons/lang/index/Memo
ryIndex.java:[17,65] -source 1.6 中不支持 diamond 运算符
[ERROR] (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/code/nlp-lang-master/src/main/java/org/nlpcn/commons/lang/dat/DATMak
er.java:[52,58] -source 1.6 中不支持 diamond 运算符
[ERROR] (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] /D:/code/nlp-lang-master/src/main/java/org/nlpcn/commons/lang/dat/DATMak
er.java:[267,13] -source 1.6 中不支持 try-with-resources
[ERROR] (请使用 -source 7 或更高版本以启用 try-with-resources)
[ERROR] /D:/code/nlp-lang-master/src/main/java/org/nlpcn/commons/lang/occurrence
/Occurrence.java:[231,36] -source 1.6 中不支持 diamond 运算符
[ERROR] (请使用 -source 7 或更高版本以启用 diamond 运算符)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption

指java的版本

POM.XML修改

<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>
				<compilerId>eclipse</compilerId>
			</configuration>
			<dependencies>
				<dependency>
					<groupId>org.codehaus.plexus</groupId>
					<artifactId>plexus-compiler-eclipse</artifactId>
					<version>2.2</version>
				</dependency>
			</dependencies>
		</plugin>
		
			<plugin>
				<artifactId>maven-jar-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>jar</goal>
						</goals>
						<phase>package</phase>
					</execution>
				</executions>
			</plugin>
		</plugins>


		<extensions>
			<extension>
				<groupId>org.apache.maven.wagon</groupId>
				<artifactId>wagon-ssh-external</artifactId>
				<version>2.9</version>
			</extension>
		</extensions>
	</build>

打包成功

D:\code\nlp-lang-master>mvn install -Dmaven.test.skip=true
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
org.nlpcn:nlp-lang:jar:1.0.2
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-
plugin is missing. @ line 94, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten t
he stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support buildin
g such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building nlp-lang 1.0.2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ nlp-lang -
--
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 8 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ nlp-lang ---
Downloading: https://repo.maven.apache.org/maven2/org/eclipse/tycho/org.eclipse.
jdt.core/3.8.1.v20120531-0637/org.eclipse.jdt.core-3.8.1.v20120531-0637.jar
Downloaded: https://repo.maven.apache.org/maven2/org/eclipse/tycho/org.eclipse.j
dt.core/3.8.1.v20120531-0637/org.eclipse.jdt.core-3.8.1.v20120531-0637.jar (4575
 KB at 46.8 KB/sec)
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ nl
p-lang ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ nlp-lan
g ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ nlp-lang ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ nlp-lang ---
[INFO] Building jar: D:\code\nlp-lang-master\target\nlp-lang-1.0.2.jar
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default) @ nlp-lang ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ nlp-lang ---
[INFO] Installing D:\code\nlp-lang-master\target\nlp-lang-1.0.2.jar to D:\Java\.
m2\repository\org\nlpcn\nlp-lang\1.0.2\nlp-lang-1.0.2.jar
[INFO] Installing D:\code\nlp-lang-master\pom.xml to D:\Java\.m2\repository\org\
nlpcn\nlp-lang\1.0.2\nlp-lang-1.0.2.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:43 min
[INFO] Finished at: 2015-08-07T16:48:51+08:00
[INFO] Final Memory: 20M/179M
[INFO] ------------------------------------------------------------------------


错误: -source 1.6 中不支持 diamond 运算符的解决办法

在取一段github代码时,发现说是支持jdk 7 ,但是使用MAVEN编译不过去。 报错信息为错误: -source 1.6 中不支持 diamond 运算符 我使用的环境是1.7  +...
  • mingjie1212
  • mingjie1212
  • 2016-09-01 23:30:06
  • 14021

错误: -source 1.6 中不支持 diamond 运算符 (请使用 -source 7 或更高版本以启用 diamond 运算符)

今天晚上运行校长项目时,报错如下: Error:(71, 35) 错误: -source 1.6 中不支持 diamond 运算符(请使用 -source 7 或更高版本以启用 diamond 运算符...
  • Bossgirls
  • Bossgirls
  • 2015-01-08 23:41:55
  • 31638

安卓学习笔记---使用AndroidStudio出现的问题错误(错误: -source 1.6 中不支持 diamond 运算符 (请使用 -source 7 或更高版本以启用 diamond 运算)

今天想着使用AndroidStudio来构建项目,说实话,虽然也了解一些,但是真正还没上手做过项目,今天在使用测时候出现了这么一个问题: Error:(71, 35) 错误: -source 1.6...
  • juhua2012
  • juhua2012
  • 2016-07-18 10:32:41
  • 2961

idea 提示:-source 1.6 中不支持 diamond 运算符的解决办法

之前项目运行的很好,没有任何问题,短时间内不打算在二次开发了,所以也就从project下删除了该model,今天突然想看一下这个项目,然后就把项目导入进来,结果打包的时候提示我”-source 1.6...
  • qq_33547169
  • qq_33547169
  • 2017-10-10 15:17:45
  • 368

关于Maven installed出现source 1.5 中不支持 diamond 运算符问题(请使用 -source 7 或更高版本以启用 diamond 运算符)

Maven installed出现source 1.5 中不支持 diamond 运算符问题(请使用 -source 7 或更高版本以启用 diamond 运算符)...
  • u013188532
  • u013188532
  • 2016-08-10 09:03:57
  • 13123

[Spring Boot Debug]在 intellij idea 中无法编译 javad代码 -source 1.6 中不支持 diamond 运算符

利用intellij idea的project structure中配置 java版本1.8时,依旧报错 后面在pom.xml中加入代码搞定 maven-compil...
  • zhouhuakang
  • zhouhuakang
  • 2015-08-14 10:24:20
  • 3348

IntelliJ Idea编译报错:请使用 -source 7 或更高版本以启用 diamond 运算符

IntelliJ Idea maven项目编译报错: Information:Using javac 1.7.0_79 to compile java sources Information:jav...
  • RickyIT
  • RickyIT
  • 2016-04-13 18:33:03
  • 11688

gradle编译错误:-source 1.6 中不支持 diamond 运算符

Gradle版本是2.14,JDK版本是1.6。 从地址:https://github.com/rovo89/XposedBridge.git下载最新XposedBridge源码,配置好sdk路径,...
  • harry_helei
  • harry_helei
  • 2016-12-09 15:33:21
  • 991

兔子--Error:(88, 35) 错误: -source 1.6 中不支持 diamond 运算符 (请使用 -source 7 或更高版本以启用 diamond 运算符)

Error:(88, 35) 错误: -source 1.6 中不支持 diamond 运算符 (请使用 -source 7 或更高版本以启用 diamond 运算符) 出错地方:List ...
  • u013425527
  • u013425527
  • 2015-04-18 18:49:07
  • 2917

错误: -source 1.5 中不支持 diamond 运算符的解决办法

http://blog.csdn.net/mingjie1212/article/details/52404297 然后又遇到了这个问题 http://blog.csdn.net/wave...
  • liu1pan2min3
  • liu1pan2min3
  • 2017-02-16 22:26:17
  • 471
收藏助手
不良信息举报
您举报文章:mvn 请使用 -source 7 或更高版本以启用 diamond 运算符
举报原因:
原因补充:

(最多只允许输入30个字)