我正在TFS 2015中运行一个版本,但出现此错误:
[错误]
l org.apache.maven.plugins:maven-compiler-plugin:3.6.2:在项目pia-branch-rest-api上进行编译(默认编译):致命错误编译:无效目标版本:1.8-> [帮助1] org.apache.maven.lifecycle.LifecycleExecutionException:无法在项目pia-branch-rest-api上执行目标org.apache.maven.plugins:maven-compiler-plugin:3.6.2:compile(默认编译):致命错误编译
在org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
由以下原因引起:org.apache.maven.plugin.MojoExecutionException:致命错误编译
222 2018-07-25T11:22:37.0150577Z at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:963)
223 2018-07-25T11:22:37.0150577Z at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:158)
224 2018-07-25T11:22:37.0150577Z at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
225 2018-07-25T11:22:37.0150577Z at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
226 2018-07-25T11:22:37.0150577Z ...还有19个
227 2018-07-25T11:22:37.0306811Z由以下原因引起:org.codehaus.plexus.compiler.CompilerException:无效的目标版本:1.8
228 2018-07-25T11:22:37.0306811Z at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:173)
229 2018-07-25T11:22:37.0306811Z at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
230 2018-07-25T11:22:37.0306811Z at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:952)
231 2018-07-25T11:22:37.0306811Z ...另外22个
232 2018-07-25T11:22:37.0306811Z原因:java.lang.IllegalArgumentException:目标版本无效:1.8
233 2018-07-25T11:22:37.0306811Z at com.sun.tools.javac.main.RecognizedOptions $ GrumpyHelper.error(RecognizedOptions.java:75)
234 2018-07-25T11:22:37.0306811Z at com.sun.tools.javac.main.RecognizedOptions $ 14.process(RecognizedOptions.java:380)
235 2018-07-25T11:22:37.0306811Z at com.sun.tools.javac.api.JavacTool.processOptions(JavacTool.java:247)
在com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:207)
在com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:53)
在org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:125)
Pom.xml(摘要)
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.plugin.compiler.version}</version>
<configuration>
<source>${compile.source.version}</source>
<target>${compile.target.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven.plugin.deploy.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven.plugin.jar.version}</version>
<configuration>
<archive>
<manifest>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Vendor-Url>${project.organization.url}</Vendor-Url>
<Build-Revision>${buildNumber}</Build-Revision>
<Build-Date>${timestamp}</Build-Date>
</manifestEntries>
</archive>
<skipIfEmpty>true</skipIfEmpty>
</configuration>
<executions>
<execution>
<id>test-jar</id>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven.plugin.javadoc.version}</version>
<configuration>
<failOnError>false</failOnError>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven.plugin.release.version}</version>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>${maven.scm.provider.svnjava.version}</version>
</dependency>
</dependencies>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven.plugin.resources.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven.plugin.source.version}</version>
<configuration>
<archive>
<manifest>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Vendor-Url>${project.organization.url}</Vendor-Url>
<Build-Revision>${buildNumber}</Build-Revision>
<Build-Date>${timestamp}</Build-Date>
</manifestEntries>
</archive>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
<execution>
<id>attach-test-sources</id>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.plugin.surefire.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>${maven.plugin.buildnumber.version}</version>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>${maven.scm.provider.svnjava.version}</version>
</dependency>
<dependency>
<groupId>org.tmatesoft.svnkit</groupId>
<artifactId>svnkit</artifactId>
<version>${svnkit.version}</version>
</dependency>
</dependencies>
<configuration>
<!-- never touch svn -->
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<timestampFormat>{0,date,yyyy-MM-dd HH:mm:ss}</timestampFormat>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>buildnumber-plugin</id>
<activation>
<property>
<!-- This profile is activated if NO system property 'skipBuildnumber'
is found. Disable this profile by specifying -DskipBuildnumber=true on the
commandline -->
<name>!skipBuildnumber</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>buildnumber</id>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<format>{0,number}</format>
<items>
<item>buildNumber</item>
</items>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<revisionOnScmFailure>unknownbuild</revisionOnScmFailure>
</configuration>
</plugin>
</plugins>
答案 0 :(得分:0)
请问您是否将JAVA_HOME设置为1.8的SDK
答案 1 :(得分:0)
请检查您的构建代理的功能。
确保已安装 SDK 1.8 ,并且JAVA_HOME
设置为该版本,并且由构建代理标识。
在构建代理机器上运行以下命令以检查JAVA_HOME设置:
echo %JAVA_HOME%
echo %JDK_HOME%
echo %JRE_HOME%
更多信息,请参考此主题进行故障排除:Fatal error compiling: invalid target release: 1.8 -> [Help 1]