首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未能执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (默认编译)

未能执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (默认编译)
EN

Stack Overflow用户
提问于 2021-11-26 23:56:39
回答 1查看 970关注 0票数 0

我想生成一个JAR,但是每次我得到这个错误:

控制台日志

代码语言:javascript
复制
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.160 s
[INFO] Finished at: 2021-11-27T00:37:06+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)
        on project qengine: Fatal error compiling: invalid target release: 9 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionExceptions
代码语言:javascript
复制
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>napd</groupId>
    <artifactId>qengine</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.eclipse.rdf4j</groupId>
                <artifactId>rdf4j-bom</artifactId>
                <version>3.7.3</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.eclipse.rdf4j</groupId>
            <artifactId>rdf4j-client</artifactId>
            <type>pom</type>
        </dependency>

        <dependency>
            <groupId>org.apache.jena</groupId>
            <artifactId>apache-jena</artifactId>
            <type>pom</type>
            <version>3.9.0</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> 
                <configuration> <source>8</source> <target>8</target> </configuration> </plugin> 
                <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> 
                <configuration> <archive> <manifest> <mainClass>qengine.Main</mainClass> 
                </manifest> </archive> </configuration> </plugin> -->
        
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/allJars</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> 
                <configuration> <source>9</source> <target>9</target> </configuration> </plugin> -->

            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <configuration>
                <source>9</source>
                <target>9</target>
              </configuration>
            </plugin>
            
        </plugins>
    </build>

</project>
EN

回答 1

Stack Overflow用户

发布于 2021-11-27 00:05:34

(1) JAVA_HOME变量是否配置为JDK 9路径?

(2)尝试将configuration替换为maven-compiler-plugin

代码语言:javascript
复制
<configuration>
  <fork>true</fork>
  <executable>javac9</executable>
</configuration>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70131077

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档