简体   繁体   English

如何从maven插件使用的类路径中排除项目依赖项

[英]How to exclude project dependency from classpath used by maven plugin

I am using the Exec Maven Plugin to run a java program inside of my maven build. 我正在使用Exec Maven插件在我的maven构建中运行一个java程序。 I have a problem when executing this java program using the exec plugin, because it executes with a classpath which contains the project's dependencies, including an xml parser implementation which is not wanted in the executed java program and leads to errors. 我在使用exec插件执行此java程序时遇到问题,因为它使用包含项目依赖项的类路径执行,包括在执行的java程序中不需要的xml解析器实现并导致错误。 Setting of the attribute "includeProjectDependencies" to false is not an option, because I need the other dependencies from the project (and don't want to set them explicitly to plugins execution configuration to avoid duplication). 将属性“includeProjectDependencies”设置为false不是一个选项,因为我需要项目中的其他依赖项(并且不希望将它们显式设置为插件执行配置以避免重复)。 Is there a way to exclude it from the classpath when running the program through the exec plugin? 有没有办法在通过exec插件运行程序时将其从类路径中排除? I only know how I could exclude the dependency in the project (which is wrong because I need it in the resulting war-file) or how to exclude dependencies of the plugin, but cannot find a way how to exclude the project's dependency when executing the plulgin... 我只知道如何排除项目中的依赖项(这是错误的,因为我需要在生成的war文件中)或如何排除插件的依赖项,但无法找到如何在执行时排除项目依赖项的方法plulgin ...

I hope there is a way to achieve what I want and would be very helpful if anybody could give me some advice. 我希望有一种方法可以达到我想要的效果,如果有人能给我一些建议,我会非常乐于助人。

Thnx, Marko Thnx,Marko

There is issue created please follow it. 有问题,请关注它。

If you really need it for your development purpose build and use locally 如果您真的需要它用于您的开发目的,请在本地构建和使用

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

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