我在intellij中创建了一个maven项目并添加了scala框架支持
此项目名称为 sparkexamples ,我添加了必要的依赖项
以下是项目目录结构。
S:\surender\intellij_1\sparkexamples
S:\surender\intellij_1\sparkexamples\src\main\scala\com\test\spark\examples\DemoMain.scala
S:\surender\intellij_1\sparkexamples\pom.xml
我从命令提示符进入S:\ surender \ intellij_1 \ sparkexamples并开始运行以下mvn命令
mvn clean compile
mvn package
运行mvn包之后我可以在cons
中看到S:\surender\intellij_1\sparkexamples>mvn clean compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building spark-examples 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ spark-examples ---
[INFO] Deleting S:\surender\intellij_1\sparkexamples\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spark-exam
ples ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ spark- examples
---
[INFO] No sources to compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.950 s
[INFO] Finished at: 2017-03-28T10:46:18+01:00
[INFO] Final Memory: 13M/224M
[INFO] ------------------------------------------------------------------------
S:\surender\intellij_1\sparkexamples>mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building spark-examples 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spark-exam
ples ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ spark-examples
---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ sp
ark-examples ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory S:\surender\intellij_1\sparkexamples\
src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ spark-e
xamples ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ spark- examples ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ spark-examples ---
[INFO] Building jar: S:\surender\intellij_1\sparkexamples\target\spark-examples-
1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.651 s
[INFO] Finished at: 2017-03-28T10:47:09+01:00
[INFO] Final Memory: 15M/225M
[INFO] ------------------------------------------------------------------------
S:\surender\intellij_1\sparkexamples>ole that **No Sources to compile**
有人可以帮我解决这个问题吗?
答案 0 :(得分:0)
Maven编译器是" incremental"默认情况下。 (这意味着只有编译目标是" incremental",默认情况下,Maven仍会让你浏览整个lifecycle。)
当你第一次做的时候:
mvn clean compile
您的来源已编译完毕。 (生命周期:你跑到并包括compile
生命周期阶段。)
然后你做了:
mvn package
再次调用编译器,并观察到它之前已经完成了它的工作。 (生命周期:package
是延长compile
阶段的生命周期阶段。)
这似乎发生了什么。免责声明:您只包含mvn package
的输出。如果您的mvn compile
也告诉您没有任何内容可以编译,那么其他内容正在进行中,您可能想要重新解释您的问题(或发布一个新问题)。
此外,如果这个生命周期的事情搞砸了你,还有一个提示:compile
是一个生命周期阶段,许多人把它与做某个特定的任务混淆了#34;它不是。来自mvn -h
:
usage: mvn [options] [<goal(s)>] [<phase(s)>]
同样,compile
是一个阶段,如果你想做一个目标(&#34; task&#34;),如果这样做的话只需编译:{{1}}(compiler:compile
)。