jaxb与maven的情节汇编 [英] jaxb episodic compilation with maven

查看:76
本文介绍了jaxb与maven的情节汇编的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to execute the maven-jaxb2-plugin-sample-episode-0.7.4 (explained here and with a download available) to try separate schema compilation. Despite it compiles the first schema (A), it fails in the second one (B) because it is not able to resolve the artifact maven-jaxb2-plugin-sample-episode-a-maven:jar:0.7.4.

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

I execute mvn assembly:assembly from the command line (windows) and this is the error I get:

...
[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)

The example should work as it is so, what am I doing wrong ? In the real scenario I have more than 10 schemas that have to be compiled as different episodes, so I need the proccess to be automatic (i.e no need to execute "mvn something" for each individual artifact)

推荐答案

模块 maven-jaxb2-plugin-ample-episode-b-maven 取决于 maven-jaxb2-plugin-ample-episode-a-maven

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

When mvn assembly:assembly is run from the parent folder (which contains the two modules), it builds the jar for maven-jaxb2-plugin-ample-episode-a-maven, but does not install it in your local repository.

当它尝试构建 maven-jaxb2-plugin-ample-episode-b-maven 时,它看起来对于依赖项( maven-jaxb2-plugin-ample-episode-a-maven )并且无法在本地存储库中找到它。因此错误。

When it then tries to build maven-jaxb2-plugin-ample-episode-b-maven, it looks for the dependency (maven-jaxb2-plugin-ample-episode-a-maven) and fails to find it in the local repository. Thus the error.

问题是,为什么要运行 mvn assembly:assembly ,这是使用的创建二进制分发?两个模块中都没有汇编描述符。

The question is, why would you want to run mvn assembly:assembly, which is used to create a binary distribution? There are no assembly descriptors in either module.

mvn install 运行正常并成功构建两个模块。

mvn install works fine and build both the modules successfully.

这篇关于jaxb与maven的情节汇编的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆