我尝试使用Maven编译简单的Scala Spark程序。我使用IntelliJ,并且能够在IntelliJ上成功运行代码。但是当我尝试使用maven创建jar文件时,尽管一切正常,但maven说:
no source to compile
我的目录和文件顺序正确:
src-> main-> scala-> Main.scala
$ mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< veribilimiokulu:maven-scala-deneme >-----------------
[INFO] Building maven-scala-deneme 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.fasterxml.jackson.core:jackson-core:jar:2.6.7 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.fasterxml.jackson.core:jackson-databind:jar:2.6.7.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.apache.commons:commons-crypto:jar:1.0.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.fasterxml.jackson.core:jackson-databind:jar:2.6.7 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-scala-deneme ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven-scala-deneme ---
[INFO] No sources to compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.941 s
[INFO] Finished at: 2018-08-04T23:00:14+03:00
[INFO] ------------------------------------------------------------------------
我的pom.xml文件在下面,我只是将依赖项元素放进去:
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.8</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.11</artifactId>
<version>3.2.0-SNAP10</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_2.11</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>