简体   繁体   English

Maven依赖插件问题

[英]Maven dependency plugin problems

I use maven-assembly plugin to create a zip file for a release in my target folder. 我使用maven-assembly插件为目标文件夹中的发行版创建一个zip文件。 This package with dynamic name includes a configuration file; 这个具有动态名称的软件包包括一个配置文件;

/target/dailyrelease-4234.zip/cd/lib/conf/wrapper.conf

Now I also use maven-dependency plugin's build-classpath goal to output the dependencies as a string. 现在,我还使用maven-dependency插件的build-classpath目标将依赖项输出为字符串。

I want to write this output string to the configuration file created by the assembly plugin 我想将此输出字符串写入由程序集插件创建的配置文件

I have 2 problems: 我有2个问题:

1- How can I access this conf file in the dynamic named zip? 1-如何在动态命名的zip中访问此conf文件?

2- I want to add some extra .jar paths to that string created by maven dependency plugin, but it only copies the names from local repository. 2-我想在由maven依赖插件创建的字符串中添加一些额外的.jar路径,但是它仅复制本地存储库中的名称。 is there a way to modify this output, or show dependency plugin to use another folder to pick the jar names and not from local repository? 有没有办法修改此输出,或显示依赖项插件以使用另一个文件夹来选择jar名称而不是从本地存储库中呢?

Or even better make the creating dependency names task as a part of assembly-plugin so I dont need to access and modify that zip anymore. 甚至更好地将创建依赖项名称任务作为程序集插件的一部分,因此我不再需要访问和修改该zip。

1 - It sounds like your mechanism for dynamically generating that number '4234' exists outside of Maven, and you're trying to figure out how to access that number from within Maven, correct? 1-听起来您的动态生成数字“ 4234”的机制存在 Maven 之外 ,而您正在尝试弄清楚如何从Maven内部访问该数字,对吗?

If so, I suggest using the buildnumber-maven-plugin which generates a number which you can then access from within Maven via the ${buildNumber} property. 如果是这样,我建议使用buildnumber-maven-plugin生成一个数字,然后可以通过${buildNumber}属性从Maven内部访问该数字。

2 - I suggest switching your callout from dependency:build-classpath to dependency:list -DoutputFile=xyz.txt . 2-我建议将标注从dependency:build-classpath切换为dependency:list -DoutputFile=xyz.txt The latter gives you a cleaner output of just groupId/artifactId/version which should be easy to edit. 后者为您提供了更清晰的groupId / artifactId / version输出,应该易于编辑。

Or better yet... Do the above, and simply use <phase> configuration to ensure dependency:list gets called before the assembly plugin runs (typically at the end of package phase), and ensure the resulting output file sits somewhere that the assembly plugin will pick it up. 或者更好的方法是...执行上述操作,并简单地使用<phase>配置来确保dependency:list在程序集插件运行之前被调用(通常在package阶段结束时),并确保生成的输出文件位于程序集所在的某个位置插件会把它捡起来。

Hope that helps. 希望能有所帮助。

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

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