简体   繁体   English

蚂蚁到maven迁移maven - jar建筑

[英]ant to maven migration maven - jar building

I am migrating an Ant project to Maven. 我正在将一个Ant项目迁移到Maven。 There are a lot of Java projects in "Ant solution" which are only compiled to a specific directory (compiled to *.class files and copied to build folder). “Ant解决方案”中有很多Java项目,它们只编译到特定目录(编译为* .class文件并复制到build文件夹)。 Ie some project A uses dependencies from project B, which are preceded by copying *.class files from output folder B to resource folder project A. 即一些项目A使用项目B的依赖项,其前面是将* .class文件从输出文件夹B复制到资源文件夹项目A.

Are there any possibilities to create a Maven jar-Module which uses another jar-Module only for compilation? 有没有可能创建一个Maven jar-Module,它只使用另一个jar-Module进行编译? Without using <dependency> ? 不使用<dependency>

Are there any possibilities to create a Maven jar-Module which uses another jar-Module only for compilation? 有没有可能创建一个Maven jar-Module,它只使用另一个jar-Module进行编译?
Yes, see below 是的,见下文
Without using <dependency>? 不使用<dependency>?
If you are using another module in your project, then you have a dependency on that project and should be declared as such. 如果您在项目中使用另一个模块,那么您对该项目具有依赖性,应该如此声明。 If you have a scope of provided, then the project which you depend on will only be used when compiling your project but will not be included in the final jar as it expects the classes it depends on to be provided at runtime. 如果您有一个提供的范围,那么您所依赖的项目将仅在编译项目时使用,但不会包含在最终的jar中,因为它期望在运行时提供它所依赖的类。

Not entirely sure if I understood your question correctly as I do not see why you would want to not use the <dependency> section when you state in your question that you actually have dependencies. 不完全确定我是否正确理解了您的问题,因为我不明白为什么在您在问题中声明您确实存在依赖关系时不希望使用<dependency>部分。

http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

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

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