tycho插件+ maven-dependency-plugin:从本地项目复制依赖项,而不是从存储库复制 [英] tycho plugin + maven-dependency-plugin: copy dependencies from local projects instead repositories
问题描述
主要目标:将项目部署为jar 和 eclipse-plugin
Main Goal: deploy a project as jar and eclipse-plugin
当前状态:项目可以像jar包一样良好构建
current state: project builds fine as jar package
现在我想创建第二个项目,将jar项目包装为eclipse插件
Now i want to create a second project which wraps the jar project as eclipse plugin
- 使用tycho-maven-plugin创建eclipse-plugin
- 添加原始项目的jar(具有复制依赖性)
- 添加激活器
- 从jar导出软件包
- 创建正确的MANIFEST.MF
我尝试使用绑定到create-resources的复制依赖项来复制jar.只要在存储库中找到罐子,此方法就起作用,但是本地项目将被忽略. 由于找不到该jar,因此会导致构建失败.
i tried to copy the jar with copy-dependencies bound to create-resources. This works as long the jar is found in repository, but the local project gets ignored. This results in a build failure since the jar is not found.
是否可以告诉复制依赖项从项目的目标目录中获取jar?还是我应该使用除tycho以外的其他方法?
Is it possible to tell copy-dependencies to take the jar from the target directory of the project? Or should i use some other method than using tycho?
我通过4个项目解决了我的问题:
I solved my problem with 4 projects:
- 正常项目(这里没什么特别的)
- 使用tycho maven和副本依赖项的包装器项目. 将副本依赖项绑定到某个目标,然后再进行编译(例如,generate-resources).排除了在MANIFEST.MF中被设置为依赖项的所有人工制品.
- 准备项目,该项目将调用正常项目并将其安装到存储库中.之所以需要这样做,是因为tycho-maven-plugin必须进行验证,并且不可能事先调用exec插件(至少不容易).
- 一个多模块项目,在包装项目之前先调用prepare项目.
- normal project (nothing special here)
- the wrapper project using tycho maven and copy-dependencies. bound copy dependencies to some goal before compile (e.g. generate-resources). Excluded all artefactid which were set as dependency in the MANIFEST.MF.
- a prepare project, which calls the normal project and installs it into the repo. This is needed because the tycho-maven-plugin is bound to validate and it is not possible to call the exec plugin beforehand (at least not easy).
- a multi module project which calls the prepare project before the wrapper project.
推荐答案
使用"mvm install"构建本地项目(缺少工件).它将部署在您的本地存储库($ USER_HOME $/.m2/repositories)中.此依赖关系解决之后.
Build your local project (which artifact was missed) with "mvm install". It will be deployed in your local repository ($USER_HOME$/.m2/repositories). After this dependency should be resolved.
或者,如果您有本地公司的Maven存储库(例如Artifactory或Nexus),则可以"MVN部署".
Alternatively you can "mvn deploy" if you have local company maven repository like Artifactory or Nexus.
这篇关于tycho插件+ maven-dependency-plugin:从本地项目复制依赖项,而不是从存储库复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!