不再支持另一个Maven“源"选项6.使用7或更高版本." [英] Another Maven "Source option 6 is no longer supported. Use 7 or later."

查看:58
本文介绍了不再支持另一个Maven“源"选项6.使用7或更高版本."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了这个问题的很多答案,但它们对我没有用.我在PC上安装了Visual Studion Code,Java和Maven的最新版本,并且能够在PC上使用Maven成功构建应用程序.然后,我在Mac上执行了相同的步骤,但出现此错误.

I see lots of answers to this question but they don't work for me. I installed Visual Studion Code, latest version of Java and Maven on my PC and I was able to successfully build my application with Maven on the PC. I then went through the same steps on my Mac and I get this error.

Macos,Visual Studio Code,Maven和Java的新版本.就像所有其他人所说的那样,我将以下行添加到了pom.xml文件的properties部分:

Fresh versions of Macos, Visual Studio Code, Maven and Java. Like all the others have said, I added these lines to the properties section of my pom.xml file:

    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

仍然出现相同的错误.这是mvn构建的相关输出:

Still get the same error. Here is the relevant output from the mvn build:

alberts-mbp:com.versabuilt.rushmore.process albertyoungwerth$ mvn package
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------< com.versabuilt.rushmore.process:VersaBuiltProcess >----------
[INFO] Building VersaBuilt Process 0.2.18
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ VersaBuiltProcess ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) @ VersaBuiltProcess ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 10 source files to /Users/albertyoungwerth/rushmore/com.versabuilt.rushmore.process/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] Source option 6 is no longer supported. Use 7 or later.
[ERROR] Target option 6 is no longer supported. Use 7 or later.
[INFO] 2 errors

我也重新启动了Visual Studio Code,但无济于事.请让我知道其他有用的信息.谢谢!

I have also restarted Visual Studio Code to no avail. Please let me know what other information would be useful. Thanks!

推荐答案

我使用的最后一个构建系统叫做 make,所以我已经有一段时间没有调试构建过程了.我不记得也无法转储62Kb的调试输出...

The last build system I used was called make, so it's been a while since I debugged a build process. I don't remember make dumping 62Kb of debug output either...

任何人都在搜索关键字"source"(提示那是我应该添加的标签之一),使我在maven调试输出中看到了这一点:

Anywho, searching for the keyword "source" (clue being that was one of the tags I was supposed to add) got me to this in the maven debug output:

[DEBUG](f)源= 1.6

[DEBUG] (f) source = 1.6

啊哈!源编译器版本没有更改,就像我在原始问题中通过编辑要求的那样!我敢打赌,行家们改变了xml标签的位置!果然,在pom.xml文件中搜索1.6,我发现:

Ahaaa! the source compiler version had not changed like I asked it to with the edit in my original question! I'll bet the maven folks changed the location of the xml tag! Sure enough, searching for 1.6 in the pom.xml file I find this:

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

我将源标签值和目标标签值更改为1.8,并且可以正常工作!我还尝试删除了构建插件范围中的source和target标记,并将其保留在设置为1.8的maven.compiler.source/target值中,这也是可行的.

I changed the source and target tag values to 1.8 and it worked! I also tried deleting the source and target tags in the build plugins scope and left in the maven.compiler.source/target values set to 1.8 and that also worked.

如此讲故事,请小心pom.xml文件中的其他源或目标标签!

So moral of the story, be careful of extra source or target tags in your pom.xml file!

这篇关于不再支持另一个Maven“源"选项6.使用7或更高版本."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆