[英]What's the difference between `spring-boot-maven-plugin` and `maven-compiler-plugin`?
[英]What's the difference between maven-compiler-plugin and scala-maven-plugin?
我目前正在處理混合Java和Scala(Spark)的項目。 好像這還不夠,我的一些依賴項會導入另一個版本的Spark和Scala(不兼容復古)......
總而言之,這是我的依賴樹可能是這樣的:
myProjectA
\_ myLibB
| \_ spark 1.5.2 (excluded in my pom.xml)
| \_ scala 2.10.4 (excluded in my pom.xml)
\_ spark 2.2.0 (with Scala 2.11)
| \_ scala 2.11.7
\_ scala 2.11.11
\_ java 8
在我的項目內的地圖上進行一次小修改后,編譯不再起作用了......僅供參考,修改包括在硬編碼地圖中添加元素。
因此,我正在尋找一個編譯我的項目的解決方案。 我目前正在使用此構建配置:
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.1.3</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
我意識到這個其他配置似乎工作得很好,即使在之前的配置錯誤發生了變化之后(我用maven-compiler-plugin
替換了scala-maven-plugin
maven-compiler-plugin
):
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
兩個問題:
- maven-compiler-plugin
和scala-maven-plugin
什么區別?
- 可以使用maven-compiler-plugin
高效編譯Scala代碼/混合Java-Scala代碼嗎?
maven-compiler-plugin和scala-maven-plugin有什么區別?
Maven編譯器插件主要用於編譯java源代碼。 Scala插件可以編譯Java和Scala源代碼。 Maven編譯器插件將始終是在編譯階段調用的第一個插件。 因為它無法編譯scala源解決方案要么使用一些預編譯階段來運行scala和java兼容的編譯器插件。 事實上,如果你使用scala插件,你不需要maven編譯器插件。
可以使用maven-compiler-plugin高效編譯Scala代碼/混合Java-Scala代碼嗎?
沒有
請通過此鏈接
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.