我是Eclipse和Maven的新手,当我试图在这里运行这个项目时
https://github.com/klevis/DigitRecognizer
我的系统中安装的Java JDK版本是14
java --version
java 14.0.2 2020-07-14
Java(TM) SE Runtime Environment (build 14.0.2+12-46)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project DigitRecognizer: Compilation failure
[ERROR] /Users/nitisht/git/DigitRecognizer/src/main/java/module-info.java:[1,1] modules are not supported in -source 8
[ERROR] (use -source 9 or higher to enable modules)
[ERROR] -> [Help 1]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/nitisht/.p2/pool/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/Applications/Eclipse.app/Contents/Eclipse/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/nitisht/.p2/pool/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/Applications/Eclipse.app/Contents/Eclipse/configuration/org.eclipse.osgi/5/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for ramo.klevis.ml:DigitRecognizer:jar:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.version' for junit:junit:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 88, column 22
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 152, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] -------------------< ramo.klevis.ml:DigitRecognizer >-------------------
[INFO] Building DigitRecognizer 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ DigitRecognizer ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 40 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ DigitRecognizer ---
[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 13 source files to /Users/nitisht/git/DigitRecognizer/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/nitisht/git/DigitRecognizer/src/main/java/module-info.java:[1,1] modules are not supported in -source 8
(use -source 9 or higher to enable modules)
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.810 s
[INFO] Finished at: 2020-10-04T15:36:19-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project DigitRecognizer: Compilation failure
[ERROR] /Users/nitisht/git/DigitRecognizer/src/main/java/module-info.java:[1,1] modules are not supported in -source 8
[ERROR] (use -source 9 or higher to enable modules)
[ERROR] -> [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/MojoFailureException
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://maven.apache.org/POM/4.0.0"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ramo.klevis.ml</groupId>
<artifactId>DigitRecognizer</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<slf4j.version>1.7.16</slf4j.version>
<log4j.version>2.8.1</log4j.version>
</properties>
<repositories>
<repository>
<id>a</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<!-- <repositories>
<repository><id>a</id><url>https://mvnrepository.com/artifact/org.apache.spark/spark-core_2.10</url></repository>
</repositories>-->
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-core_2.10 -->
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-core -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.2.0</version>
</dependency>
<!--LOGGER-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-ext -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-ext</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- Binding for Log4J -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- Log4j API and Core implementation required for binding -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-mllib_2.10 -->
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-mllib -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-client -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swingx</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>net.java.dev.glazedlists</groupId>
<artifactId>glazedlists_java16</artifactId>
<version>1.10.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.mortennobel/java-image-scaling -->
<dependency>
<groupId>com.mortennobel</groupId>
<artifactId>java-image-scaling</artifactId>
<version>0.8.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.deeplearning4j/deeplearning4j-core -->
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-core</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native-platform</artifactId>
<version>0.9.1</version>
</dependency>
<!-- <dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-cuda-7.5</artifactId>
<version>0.9.1</version>
</dependency>-->
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-zoo</artifactId>
<version>0.9.1</version>
</dependency>
</dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-core_2.10 -->
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>ramo.klevis.Run</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>ramo.klevis.Run</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>resources</directory>
</resource>
</resources>
</build>
</project>
您需要为下面的插件定义更新pom.xml。正如错误所述,Java版本8不支持模块。您需要将下面的版本更新到您需要的版本。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
编辑-此问题已解决-通过设置:“设置”解决了此问题- 我正在学习下面的示例/教程https://www.logicbig.com/tutorials/core-java-tutorial/modules/getting-started-in-intellij.html 这不是一个maven项目。我已经在项目结构中将源代码级别设置为9,例如 我已将项目级别设置为9: 当尝试构建/运行项目的主类时,我
问题内容: 我正在使用maven 3.3.9在Jenkins上运行编译。我在某些代码上收到此错误,但不是全部: -source 1.6不支持multi-catch语句(使用-source 7或更高版本来启用multi-catch语句) 我正在使用Java 8进行编译: 执行Maven:-B -f /opt/jenkins/workspace/product/product-Content- Ope
问题内容: 我不知道为什么编写代码: 它说 我已经使用了JDK 1.7。当我在Eclipse中打开它时,我没有收到该错误。 问题答案: 意味着您的代码将与Java 1.5版兼容,并且不能使用稍后介绍的语言构造。阅读http://docs.oracle.com/javase/8/docs/technotes/tools/unix/javac.html以了解更多信息。 实现所需目标的简单方法(能够使用
我正在使用maven 3.3.9在Jenkins上运行编译。我在一些代码(但不是所有代码)上遇到此错误: -source 1.6中不支持multi-catch语句(使用-source 7或更高版本启用multi-catch语句) 我正在用Java 8编译: 执行Maven:-B-f/opt/jenkins/workspace/product/product-Content-Operations\u
我看到了这个问题的许多答案,但它们对我不起作用。我在我的PC上安装了Visual Studio代码、最新版本的Java和Maven,并且我能够在PC上用Maven成功地构建我的应用程序。然后,我在我的Mac上经历了同样的步骤,我得到了这个错误。 Macos、Visual Studio代码、Maven和Java的新版本。就像所有其他人所说的,我将这些行添加到pom的属性部分。xml文件: 仍然得到相
因此,我试图在IntelliJ上运行java rest api,但我有一个问题标题中的例外: 错误:(42,70)java:在-source 1.6中不支持文本中的下划线(使用-source 7或更高版本来启用文本中的下划线) 我正在使用Java13,它在mac上。 我该怎么解决这个问题?