为已制作的 jar 设置 Maven 项目
我有一些 jar 文件需要包含在我的构建中 - 我宁愿不将它们指定为系统依赖项 - 这会给安装带来一场噩梦。我已经将它们上传到artifactory,然后可以直接将它们拉下来,但我在构建时并不总是可以访问artificialory。
我想做的是创建一个包含这些 jar 文件的项目。可以是其中一个或全部(欢迎建议)。我想知道是否有一种优雅的方式来处理这个问题?
我所做的(这显然是一个黑客)有一个项目,它获取 jar 并在编译阶段将 jar 解压到 target/classes 目录中。然后,它在打包阶段将这些类文件打包回来。它本质上再次创建了相同的 jar 文件......大量 hackey。我可以将 jar 添加到资源区域中还是可以使用不同的项目类型?我对任何想法持开放态度。
I have some jar files that I need to include in my build - I'd rather not specify them as system dependencies - that creates a nightmare for setup. I have been uploading them to artifactory and then they can be pulled down directly, but I won't always have access to artifactory while building.
What I was thinking of doing is creating a project that has these jar files in them. It could be one per or all of them (open to suggestion). I was wondering if there is a graceful way to handle this?
What I have done (which is clearly a hack) have a project that takes the jar and during the compile phase it unpacks the jar into the target/classes directory. It then packs those class files back during the package phase. it essentially creates the same jar file again...massively hackey. Could I add the jar into the resource area or is there a different project type I could use? I am open to any ideas.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试使用 install:install-file。我将按照以下方式进行处理。
install:install-file
以便在早期阶段将 jar 安装到存储库中。You may try to use install:install-file. I would go about it in the following way.
install:install-file
in pom of this project to install jars in repository in some early phase.