简体   繁体   English

Maven提取jar,使用依赖项进行编译

[英]Maven extract jar, compile new with dependencies

I have a 3rd party jar with source files that I've added to my local repo. 我有一个第三方jar,其中包含我已添加到本地存储库中的源文件。 Now I want to extract it, compile it with it's dependencies, and finally package it into a new single jar. 现在,我要提取它,并使用其依赖项对其进行编译,最后将其打包到一个新的jar中。

I've completed the first step, by using the maven-dependency-plugin . 我已经通过使用maven-dependency-plugin完成了第一步。 It extracts the jar from the repo into target/sources . 它将jar从回购中提取到target/sources

How do I set the compiler phase to include that directory during compilation? 如何设置编译器阶段以在编译期间包括该目录? I would expect it to generate errors at first, since it has other dependencies not in the pom.xml yet. 我希望它首先会产生错误,因为它还具有pom.xml没有的其他依赖项。

I've come across the assembly-plugin but I'm not sure if that would replace compiler-plugin? 我遇到了Assembly-Plug插件,但是我不确定是否可以代替Compiler-Plug插件?

Q: Why not get the compiled version (the jar, containing the compiled Java code ( *.class files)) of the 3rd party library. 问:为什么不获取第3方库的编译版本(jar,其中包含编译后的Java代码( *.class文件))。

Q: Is the 3rd party, source code available from svn / git / etc? 问:第三方的源代码是否可以从svn / git /等获得?

Q: Does the source jar or the svn / git scm, contain a Maven pom.xml file, or Ant build.xml , or Gradle build.gradle ? 问:源jar或svn / git scm是否包含Maven pom.xml文件,Ant build.xml或Gradle build.gradle Then use that to compile the code. 然后使用它来编译代码。

About the Maven Plug-ins 关于Maven插件

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

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