2

我正在尝试执行 maven-jaxb2-plugin-sample-episode-0.7.4(在此处解释并提供下载)以尝试单独的架构编译。尽管它编译了第一个模式 (A),但它在第二个模式 (B) 中失败了,因为它无法解析工件 maven-jaxb2-plugin-sample-episode-a-maven:jar:0.7.4。

mvn assembly:assembly从命令行(Windows)执行,这是我得到的错误:

...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven JAXB 2.x Plugin Sample [episode-b|maven]
[INFO] ------------------------------------------------------------------------
[INFO] [jaxb2:generate {execution: default}]
Downloading: http://repo1.maven.org/maven2/org/jvnet/jaxb2/maven2/maven-jaxb2-pl
ugin-sample-episode-a-maven/0.7.4/maven-jaxb2-plugin-sample-episode-a-maven-0.7.
4.jar
[INFO] Unable to find resource 'org.jvnet.jaxb2.maven2:maven-jaxb2-plugin-sample
-episode-a-maven:jar:0.7.4' in repository central (http://repo1.maven.org/maven2
)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Could not resolve the artifact.

Embedded error: Missing:
----------
1) org.jvnet.jaxb2.maven2:maven-jaxb2-plugin-sample-episode-a-maven:jar:0.7.4

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.jvnet.jaxb2.maven2 -DartifactId=mav
en-jaxb2-plugin-sample-episode-a-maven -Dversion=0.7.4 -Dpackaging=jar -Dfile=/p
ath/to/file

  Alternatively, if you host your own repository you can deploy the file there:

      mvn deploy:deploy-file -DgroupId=org.jvnet.jaxb2.maven2 -DartifactId=maven
-jaxb2-plugin-sample-episode-a-maven -Dversion=0.7.4 -Dpackaging=jar -Dfile=/pat
h/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) org.jvnet.jaxb2.maven2:maven-jaxb2-plugin-ample-episode-b-maven:jar:0
.7.4
        2) org.jvnet.jaxb2.maven2:maven-jaxb2-plugin-sample-episode-a-maven:jar:
0.7.4

----------
1 required artifact is missing.

for artifact:
  org.jvnet.jaxb2.maven2:maven-jaxb2-plugin-ample-episode-b-maven:jar:0.7.4

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8 seconds
[INFO] Finished at: Wed Dec 22 16:31:29 CET 2010
[INFO] Final Memory: 16M/39M
[INFO] ------------------------------------------------------------------------

该示例应该按原样工作,我做错了什么?在实际场景中,我有超过 10 个模式必须编译为不同的情节,所以我需要自动处理(即不需要为每个单独的工件执行“mvn something”)

4

1 回答 1

3

该模块maven-jaxb2-plugin-ample-episode-b-maven依赖于maven-jaxb2-plugin-ample-episode-a-maven.

mvn assembly:assembly从父文件夹(包含两个模块)运行时,它会为 jar 构建 jar maven-jaxb2-plugin-ample-episode-a-maven,但不会将其安装在本地存储库中。

然后,当它尝试构建maven-jaxb2-plugin-ample-episode-b-maven时,它会查找依赖项 ( maven-jaxb2-plugin-ample-episode-a-maven),但无法在本地存储库中找到它。因此错误。

问题是,为什么要运行mvn assembly:assembly用于创建二进制发行版的?两个模块中都没有程序集描述符。

mvn install工作正常并成功构建两个模块。

于 2010-12-30T04:38:50.523 回答