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


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] ------------------------------------------------------------------------


阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页