開始執行程式
1 . 創立 Maven 專案
2 . 選擇專案樣板
3 . 輸入專案相關資料
4 . 專案創立後雖然長很多子項目,但結果如黃框
5 . 建立檔案夾目錄
6 . 建立 Main Class
7 . 測試結果可執行
8 . 使用 Maven build
9 . 建立
10 . Build maven error
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Brian: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[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
解法
1 . 更新當前的 Jre
2 . 在 Maven 專案內的 pom 新增plugin
( work for me )
</project ...>
.
.
.
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<fork>true</fork>
<executable>C:\JAVA\jdk\bin\javac.exe</executable>
</configuration>
</plugin>
</plugins>
</build>
</project>
11 . 再次執行
參考資料 : Maven 教學-HelloMaven 第一個Maven專案 (Step by Step ~)
歡迎轉載,請註明出處。
沒有留言:
張貼留言