1

Apache Commons系列有一个相当标准的打包模式:5 个 jars(类、源代码、测试、测试源和 javadoc)、一个包含 HTML 内容的 doc 目录和一些文本文件(许可证、自述文件):

.
├── docs
├── LICENSE.txt
├── NOTICE.txt
├── RELEASE-NOTES.txt
├── commons-io-2.4-javadoc.jar
├── commons-io-2.4-sources.jar
├── commons-io-2.4-test-sources.jar
├── commons-io-2.4-tests.jar
└── commons-io-2.4.jar

我想以相同的方式打包我的一些项目,将类和方法引用到它们相应的 javadocs,以便 eclipse 在使用导入的类时可以工具提示引用。

是否有用于以 Apache Commons 样式进行打包的Ant或 Maven 的 biolerplate 配置?

4

1 回答 1

1

其中一部分很简单 - 如果您相应地创建文件夹结构并在 maven 中进行发布构建,则将创建所有 jar:

"${xxx}/src/main/java" 将用于创建 "${xxx}.jar" 和 "${xxx}-sources.jar"

"${xxx}/src/test/java" 将用于创建 "${xxx}-test.jar" 和 "${xxx}-test-sources.jar"

最重要的是,maven 发布插件还将创建 javadocs 并将它们打包为“${xxx}-test-sources.jar”

所有这些都将上传到您的 maven 存储库 - 您只需将所有内容放在正确的位置,然后调用正确的 maven 目标即可。

最重要的是,您可以使用 maven 程序集插件来创建您构建中创建的所有工件的 ZIP。我没有具体的代码,但你必须熟悉 maven 和程序集插件。我没有看到很多并发症。

if you work with several people, you probably need some infrastructure - we have a general nexus for proxying the standard repositories locally, and then one repository per maven project.

when i did the transition to maven in our organisation, it was painful for a few days, because people had to get familiar with it. but it paid off - the projects are much smaller, and deploying release builds is a breeze.

i'd recommend getting into maven, then you will see how nice&friendly dependency management can be.

于 2013-04-22T09:29:22.580 回答