常春藤:抓取的Javadoc和源 [英] Ivy: Fetching Javadocs and Sources
问题描述
我是相当新的常春藤,但已经得到了它的jar依赖工作。问题是试图建立起来,这样我就可以独立获取罐子的javadoc和来源。
I'm fairly new to Ivy, but have gotten it to work with jar dependencies. The problem is trying to set it up, so I can fetch javadocs and sources independently of jars.
我有一个简单的测试项目,但无论我在做什么,我取的类文件的jar在里面。
I have a simple test project, but no matter what I'm doing, I'm fetching the jar with the class files in it.
我有如下的的ivy.xml
文件:
<ivy-module version="1.0">
<info
organisation="com.vegicorp"
module="test"
revision="1.0"
status="release"/>
<configurations>
<conf name="default" visibility="public" extends="runtime,master"/>
<conf name="master" visibility="public"/>
<conf name="compile" visibility="public"/>
<conf name="provided" visibility="public"/>
<conf name="runtime" visibility="public" extends="compile"/>
<conf name="test" visibility="private" extends="runtime"/>
<conf name="system" visibility="public"/>
<conf name="sources" visibility="public"/>
<conf name="javadoc" visibility="public"/>
<conf name="optional" visibility="public"/>
</configurations>
<dependencies>
<dependency org="commons-logging" name="commons-logging" rev="1.1.1"
conf="compile->default"/>
<dependency org="commons-logging" name="commons-logging" rev="1.1.1"
conf="sources->default">
<artifact name="commons-logging" type="sources" ext="jar"/>
</dependency>
<dependency org="commons-logging" name="commons-logging" rev="1.1.1"
conf="javadoc->default">
<artifact name="commons-logging" type="javadoc" ext="jar"/>
</dependency>
</dependencies>
</ivy-module>
和下面的的build.xml
:
<project name="ivy-test" default="default" basedir="."
xmlns:ivy="http://ant.apache.org/ivy">
<property name="ivy.dir" value="${basedir}/ivy.dir"/>
<import file="${ivy.dir}/ivy.tasks.xml"/>
<property name="target.dir" value="${basedir}/lib"/>
<target name="-resolve">
<ivy:resolve/>
</target>
<target name="clean">
<delete dir="${target.dir}"/>
<ivy:cleancache/>
</target>
<target name="default"
depends="-resolve">
<fail message="ivy.conf is not defined">
<condition>
<not>
<isset property="ivy.conf"/>
</not>
</condition>
</fail>
<delete dir="${target.dir}"/>
<mkdir dir="${target.dir}"/>
<ivy:retrieve conf="${ivy.conf}"
pattern="${target.dir}/[artifact]-[revision].[ext]"/>
</target>
</project>
在命令行中,我将输入:
At the command line, I'll type:
$ ant -Divy.conf=compile
和,应该下载jar文件的类。
And, that should download the jarfile with the classes.
但是,如果我键入此:
$ ant -Divy.conf=sources
我要包含源,而不是类的jar文件,当我键入此:
I want the jar file that contains the sources and not the classes, and when I type this:
$ ant -Divy.conf=javadoc
我要包含javadoc和jar文件而不是源。
I want the jar file that contains the javadoc and not the sources.
我是pretty肯定这是我的的ivy.xml
这是不完全正确。我最初尝试这样的:
I'm pretty sure it's my ivy.xml
that's not quite right. I originally tried this:
<dependencies>
<dependency org="commons-logging" name="commons-logging" rev="1.1.1">
<artifact name="commons-logging" type="jar" ext="jar" conf="compile->default"/>
<artifact name="commons-logging" type="sources" ext="jar" conf="sources->default"/>
<artifact name="commons-logging" type="javadoc" ext="jar" conf="javadoc->default"/>
</dependency>
这是下载的罐子,来源和javadoc,但一下子不管我试过哪些配置。
That downloaded the jar, the sources, and javadoc, but all at once no matter which configuration I tried.
推荐答案
好吧,我想我已经想通了。我本来在想这整个过程。我的&LT;依赖和GT;
部分应该是这样的:
Okay, I think I've figured it out. I was over thinking this whole process. My <dependencies>
section should look like this:
<dependencies>
<dependency org="commons-logging" name="commons-logging" rev="1.1.1"
conf="javadoc->javadoc;sources->sources;compile->default"/>
</dependencies>
这是我的的javadoc
映射到Maven的的javadoc
我的来源
来Maven的来源
。当我映射 CONF =来源 - &GT;默认
,它映射我的来源
来Maven的默认
这是编译依赖关系。
This maps my javadoc
to Maven's javadoc
and my sources
to Maven's sources
. When I mapped conf="sources->default"
, it was mapping my sources
to Maven's default
which is the compile dependencies.
我可以在一行中指定所有的配置,我不需要单独的&LT;神器方式&gt;
实体
I can specify all the configurations in one line, and I don't need separate <artifact>
entities.
这篇关于常春藤:抓取的Javadoc和源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!