我有一个maven项目和一个SBT项目作为maven项目的模块。我需要创建一个命令maven build,它也执行SBT包任务。
是否有可用于将SBT与maven集成的插件?
感谢。
答案 0 :(得分:2)
一个选项是使用“Exec Maven插件”,这是一个做“播放编译”的例子
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>${path.to.play}</executable>
<workingDirectory>${path.to.project.root}</workingDirectory>
<arguments>
<argument>compile</argument>
</arguments>
</configuration>
</plugin>
答案 1 :(得分:1)
使用maven antrun插件(我的示例是用于构建Scala.js应用程序)。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>pre-integration-test</phase>
<configuration>
<target>
<exec executable="cmd.exe"
spawn="true">
<arg value="/c"/>
<arg value="C:\Program Files (x86)\sbt\bin\sbt.bat"/>
<arg value="fullOptJS"/>
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
由于@checat在他的评论和Launching a windows batch script using Maven exec plugin blocks the build even though the script uses "start"
的讨论中提出这一建议所致其他想法;在非Windows系统上使用mvn-exec可能仍然值得使用,也许使用maven配置文件。如果我走这条路,我会记得更新答案。