Scala Maven 插件编译失败,随机依赖项的"version cannot be empty"



长时间侦听器第一次调用。:-)

我正试图慢慢地将我们正在工作的javawebapp转移到scala,第一个小步骤是在我们的项目中编译一些scala代码。我已经将scala-maven插件添加到我们的网络应用程序特定pom中,比如:

...
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<!--version>2.10.3</version-->
<version>2.7.2</version>
</dependency>   
....
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/scala</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>

和其他变体,但这是我的最新版本。

现在这是网络应用程序的pom,我们有另一个jar的pom包含我们与其他应用程序共享的一些常见代码。而且这两个项目都依赖于其他内部jar。

我的scala类是一个位于src/main/scala中的小控制器。

当我运行maven包或任何maven命令时,我得到的错误实际上是:

[INFO] --- scala-maven-plugin:3.1.6:compile (scala-compile-first) @ producttool-webapp ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.663s
[INFO] Finished at: Thu Jan 16 15:34:09 PST 2014
[INFO] Final Memory: 16M/213M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.1.6:compile (scala-compile-fi
rst) on project producttool-webapp: Execution scala-compile-first of goal net.alchim31.maven:scala-m
aven-plugin:3.1.6:compile failed: For artifact {company.com:vine-xml:null:jar}: The version cannot be em
pty. -> [Help 1]

当我调试这个构建时,我看到了一个警告/错误,但它对我来说没有意义:

[WARNING] The POM for company.com:vine-xml:jar:1.11.1 is invalid, transitive dependencies (if any) will
not be available: 2 problems were encountered while building the effective model for company.com:vine-xm
l:
[ERROR] 'modelVersion' is missing. @ company.com:vine-xml:[unknown-version]
[ERROR] 'version' is missing. @ company.com:vine-xml:[unknown-version]

我们所依赖的子jar项目依赖于那个jar,它在他们的pom.xml中指定,它也在调试中通过,如下所示:

[DEBUG]       company.com:vine-xml:jar:1.12.2:compile
...
[DEBUG]     testArtifact: artifact=company.com:vine-xml:jar:1.12.2:compile
[DEBUG]     includeArtifact: artifact=company.com:vine-xml:jar:1.12.2:compile
[DEBUG]     startProcessChildren: artifact=company.com:vine-xml:jar:1.12.2:compile
[DEBUG]       testArtifact: artifact=javax.xml.bind:jaxb-api:jar:2.1:compile
[DEBUG]       omitForNearer: omitted=javax.xml.bind:jaxb-api:jar:2.1:compile kept=javax.xml.bind:jax

我想知道我的scala-maven插件是否没有看到任何依赖项,并询问我该如何修复它。或者有没有一种方法可以忽略这些错误,我可以在scala-maven插件中打开这些错误。

谢谢你的帮助。

我不确定是否还有其他修复方法,但从下面这样一个完全不同的子项目中排除了有问题的jar对我有效。

<exclusion>
<artifactId>vine-xml</artifactId>
<groupId>company.com</groupId>
</exclusion>

相关内容

最新更新