简体   繁体   English

在Maven构建中包括eclipse库

[英]include eclipse library in maven build

simple scenario: 简单方案:

I have a maven project, containing some maven dependencies (activiti framework) and added the Widlfly 8.1.0 runtime as library in eclipse. 我有一个Maven项目,其中包含一些Maven依赖项(Activiti框架),并在Eclipse中将Widlfly 8.1.0运行时添加为库。

naturally now, if i clean and build with MAVEN, maven won't consider the runtime while compiling and complain that it cannot find eg. 现在自然而然,如果我使用MAVEN进行清理和构建,则maven在编译时将不会考虑运行时,并抱怨找不到它。 the @Webservlet Annotation, HttpRequest classes etc. @Webservlet批注,HttpRequest类等。

so in order to build my Project, i have to run any maven goal and see it fail, just to have maven download all dependencies, then build the project with eclipses' build process which then uses all downloaded maven dependencies AND the wildfly 8.1.0 runtime, succeeding in building the project. 因此,为了构建我的项目,我必须运行任何Maven目标并看到它失败,只是要让Maven下载所有依赖项,然后使用Eclipse的构建过程构建该项目,然后使用所有下载的Maven依赖项和wildfly 8.1.0运行时,成功构建项目。

THEN only can I run maven install/deploy to create the .war, which works, because maven finds a compiled target folder, created by eclipse. 然后,我只能运行maven install / deploy来创建.war,它可以工作,因为maven找到了由eclipse创建的已编译目标文件夹。

How can i, without instlalling all runtime jars to my local repository or adding the wildfly installation as antoher local repo, tell maven or the m2e plugin to include manually added libraries to mavens compile step? 我如何在不将所有运行时jar插入我的本地存储库或将Wildfly安装作为另一个本地存储库添加的情况下,告诉maven或m2e插件将手动添加的库包括到mavens编译步骤中?

what you probably want is a "provided"*-scope dependency on org.wildfly:wildfly-spec-api:8.1.0 (which is a pom artifact containing all the apis/specifications provided to you by wildfly). 您可能想要的是对org.wildfly:wildfly-spec-api:8.1.0的“提供的” *范围依赖性(这是一个pom工件,其中包含wildfly提供给您的所有api /规范)。

assumming you intend to deploy your app inside wildfly (as opposed to embedding wildfly in your own main() somehow...) you dont need a dependency on the wildfly container. 假设您打算将应用程序部署在wildfly中(而不是以某种方式将wildfly嵌入到自己的main()中),您不需要对wildfly容器的依赖。

* - note that since wildfly-apec-api is a pom artifact (and not a jar) you need to use the import scope and not provided. * -请注意,由于wildfly-apec-api是pom工件(而不是jar),因此您需要使用导入范围,而不需要提供。 see this article for a complete guide. 请参阅本文以获取完整指南。 the gist is you put an import scope dependency on the pom in dependency management, and then you can put a provided-scope dependency on any specific member api/spec that you use (say ejb3, jsf, bean validation or jpa) and the versions will be taken from the spec-api pom. 要点是在依赖项管理中将导入范围依赖项放在pom上,然后可以在您使用的任何特定成员api / spec(例如ejb3,jsf,bean验证或jpa)和版本中提供提供范围的依赖项将取自spec-api pom。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM