简体   繁体   English

如何在ant中重用依赖项目?

[英]How to re-use a dependent project in ant?

We have a project that includes all of our re-usable classes, third-party library JARs and what not. 我们有一个项目,其中包括所有可重用的类,第三方库JAR和不包含的类。 This project is basically just where ALL of the dependencies for every project we are working on. 这个项目基本上就是我们正在处理的每个项目的所有依赖项的地方。 We may only use ant and we may not use Ivy unfortunately. 我们可能只使用蚂蚁,而不幸的是我们可能不会使用常春藤。 So for example: 因此,例如:

./Common-Project (includes all dependencies
  -build.xml (will build this project, the dependencies, and package them all into 1 jar)

./Actual-Project (just one of many projects)
  -build.xml (will call the build.xml in common and ensure it gets the latest jar and then copy that jar into its own deployment EAR)

The problem with this is that when we build all of the actual projects (say all 10 of them, or 40, or whatever it grows to) we end up building the common-project each time. 这样做的问题是,当我们构建所有实际项目时(例如全部10个项目,或者40个项目,或者随其增长的项目),我们每次都会构建公共项目。

So, here is what I want to know.... how can I package this dependency and make sure it is in fact up to date, but without constantly rebuilding it? 因此,这就是我想知道的...。我如何打包此依赖关系,并确保它实际上是最新的,但又不需要不断重建它? I'm open to any suggestions (as long as it is just ant we are doing). 我愿意接受任何建议(只要我们正在做蚂蚁)。

By default, javac ant task is executed only for updated/new sources. 默认情况下,仅对更新/新源执行javac ant任务。 IIRC, there's a similar principle for building jars. IIRC,建造罐子也有类似的原则。 So, normally it shouldn't be a problem for you. 因此,通常这对您来说不是问题。

But the problem may arise if you remove existing jar or .class files before each build. 但是,如果在每次构建之前删除现有的jar或.class文件,则可能会出现问题。 In this case, it will be repeated from scratch. 在这种情况下,将从头开始重复。

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

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