我正在使用Maven(以及Maven Eclipse Integration)来管理Eclipse中Java项目的依赖项.来自Maven存储库的JAR文件的自动下载功能可以节省时间.不幸的是,它不包括API文档和源代码.
如何设置Maven以自动获取源和javadoc附件并使用Eclipse正确注册它们?
我在Maven项目中有Spring框架依赖项.我想附加Javadoc用于spring框架依赖项.
我添加到pom.xml以下行
<repositories>
<repository>
<id>springsource-repo</id>
<name>SpringSource Repository</name>
<url>http://repo.springsource.org/release</url>
</repository>
</repositories>
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
我已经安装了m2eclipse,我还在Download Artifact Sources/Javadoc设置中选中了选项.
当我跑步时mvn eclipse:eclipse,它没有显示任何警告.但是.jar没有下载javadoc 文件.
在Java中,如果将源代码(.java)文件与类( .class)一起打包到jar中,大多数IDE都会像eclipse一样显示代码完成的javadoc注释.
IIRC很少有像JMock这样的开源项目.
让我说我已经干净地将我的API代码与实现代码分开,以便我有类似myproject-api.jar和myproject-impl.jar的东西,我有什么理由不把源代码放在我的myproject-api.jar中吗?
因为性能?尺寸?
为什么其他项目不这样做?
编辑:除了Maven下载问题,将我的源代码放入类jar以支持尽可能多的开发人员(maven与否)会有什么损害吗?