当前位置: 首页 > 知识库问答 >
问题:

失败的Maven构建

奚卓
2023-03-14

我正在TFS2015中运行一个构建,我得到了这个错误:

在org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:217)

原因:org.apache.maven.plugin.MojoExecutionException:编译时出现致命错误

222 2018-07-25T11:22:37.0150577z在org.apache.maven.plugin.compiler.abstractcompilermojo.execute(abstractcompilermojo.java:963)

223 2018-07-25T11:22:37.0150577Z在org.apache.maven.plugin.compiler.compilermojo.execute(compilermojo.java:158)

224 2018-07-25T11:22:37.0150577z在org.apache.maven.plugin.DefaultBuildPluginManager.ExecuteMojo(DefaultBuildPluginManager.java:101)

225 2018-07-25T11:22:37.0150577Z在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在org.codehaus.plexus.compiler.javac.javaxtoolscompiler.compileInProcess(javaxtoolscompiler.java:173)

229 2018-07-25T11:22:37.0306811Z在org.codehaus.plexus.compiler.javac.javaccompiler.PerformCompile(javaccompiler.java:174)

230 2018-07-25T11:22:37.0306811z在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在com.sun.tools.javac.main.RecognizedOptions$GrumpyHelper.error(RecognizedOptions.java:75)

234 2018-07-25T11:22:37.0306811z在com.sun.tools.javac.main.recognizedoptions$14.process(recognizedoptions.java:380)

235 2018-07-25T11:22:37.0306811z在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>

共有1个答案

葛驰
2023-03-14

请检查生成代理的功能。

确保您已经安装了SDK1.8,并且java_home被设置为该版本,并且由构建代理标识。

在生成代理计算机上运行以下命令以检查JAVA_HOME设置:

echo %JAVA_HOME% 
echo %JDK_HOME%
echo %JRE_HOME%

有关疑难解答的详细信息请参阅此线程:编译致命错误:目标版本无效:1.8->[帮助1]

 类似资料:
  • [错误]D:...\spark-test\java-gett-start\src\main\java\main.java:[73,35]错误:源代码1.5中不支持lambda表达式 这是一个heroku示例java项目,在System.properties文件中设置了java版本:java.runtime.version=1.8 具体行如下:

  • ----maven-enforcer-plugin:1.0.1:enforce(default)@cli---添加ignore:org.eclipse.jetty.spdy.* ----maven-enforcer-plugin:1.0.1:enforce(enforce-bang-dependencies)@cli-- ---build-helper-maven-plugin:1.7:times

  • 我正在尝试为我的spring-boot应用程序构建一个docker映像。这是我的DockerFile: 这是我的pom.xml文件,其中有我的io.fabric8插件: 当我试图使用构建docker映像时,我得到一个错误: 无法执行目标IO.fabric8:docker-maven-plugin:0.15.3:在项目详细信息上生成(default-cli)app:执行目标IO.fabric8:do

  • 我正在尝试使用Maven构建Geonetwork。源代码来自这里:https://github.com/geonetwork/core-geonetwork/tree/3.10.x 我按照本教程构建Geonetwork:https://geonetwork-opensource.org/manuals/trunk/eng/users/tutorials/introduction/deploymen

  • 问题内容: 我有一个JDK 1.7项目,该项目具有对Maven回购中的本地jar的maven依赖关系。 我无法使用Intellij来构建项目,并出现以下错误:找不到符号(符号是从本地jar导入包的类) 但是我可以使用“ mvn软件包”成功构建项目。 我已经花了很多时间寻找解决方案,而我已经做过的事情: 无效的缓存 ‘mvn clean install’本地jar依赖 在Intellij的Maven