'ant resolve or ant retrieve'を発行しても依存関係が正しく解決されないようなので、端末からAntを使ってソースをコンパイルできません。以下Java - Apache Ivyが依存関係を正しく解決していない
私のbuild.xmlとivy.xml
のbuild.xml
<!-- ANT HOME ENVIRONMENT VARIABLE -->
<property name="ant.home" value="${env.ANT_HOME}" />
<!-- IVY HOME DIRECTORY -->
<property name="ivy.home" value="${ant.home}" />
<!-- IVY2 JAR DIRECTORY (REPOSITORY) -->
<property name="ivy.default.ivy.user.dir" value="${user.home}/.ivy2"/>
<!-- DOWNLOAD IVY -->
<target name="setup" description="Install ivy">
<mkdir dir="${user.home}/.ivy2" />
<get dest="${ivy.home}/lib/ivy.jar" src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar"/>
</target>
<!-- RESOLVE CLASSPATHS -->
<target name="resolve" description="Use ivy to resolve classpaths">
<ivy:resolve file="ivy.xml" />
<ivy:report todir='target/ivy-reports' graph='false' xml='false'/>
<ivy:cachepath pathid="ivy.path" conf="compile" />
</target>
<!-- RETRIEVE DEPENDANCIES AFTER RESOLVING-->
<target name="retrieve" depends="resolve" description="Use ivy to retrieve dependencies">
<ivy:retrieve sync="true" type="jar" />
</target>
<!-- COMPILE PROJECT -->
<target name="compile" depends="clean, retrieve">
<!-- Create build directory -->
<mkdir dir="target/${ant.project.name}" />
<!-- Compile source code -->
<javac includeantruntime="false" srcdir="src" debug="true" destdir="target/${ant.project.name}" >
<classpath>
<path refid="ivy.path" />
</classpath>
</javac>
</target>
<!-- CLEAN TARGET DIRECTORY -->
<target name="clean">
<delete dir="target/orderlycalls" />
<delete dir="target/classes" />
<delete dir="target/ivy-reports" />
</target>
<!-- CLEAN TARGET AND IVY CATCHE -->
<target name="clean-all" depends="clean" description="Additionally purge ivy cache">
<ivy:cleancache/>
</target>
ivy.xml
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<configurations>
<conf name="default" visibility="public" description="The single built artifact. Nothing else"/>
<conf name="compile" visibility="public" description="The master module and transitive dependencies"/>
<conf name="provided" visibility="public" description="Needed for compile. Will be provided outside or war"/>
<conf name="runtime" visibility="public" description="Not required for compile, but for runtime" extends="compile"/>
<conf name="default" visibility="public" description="The default configuration" extends="runtime"/>
<conf name="test" visibility="private" description="Required for testing" extends="runtime"/>
</configurations>
<dependencies>
<dependency org="net.sf.trove4j" name="trove4j" rev="3.0.3" conf="provided"/>
<dependency org="org.apache.tomcat.embed" name="tomcat-embed-core" rev="7.0.53" conf="provided"/>
</dependencies>
</ivy-module>
私は '蟻のコンパイル' を実行しますcompilation antは、tomcat.jarの一部である 'Servlet Context'や 'TObject'、 'THashMap'を見つけることができないと訴えていますbuild.xmlのjarファイルを取得/解決しているにもかかわらず、trove.jarの一部です。
私が気付いたもう一つの事は、私の.ivy2 /キャッシュの内部です。//実際のjarファイルはありません。 xmlファイルのみ
私が間違っていることややっていないことは何か考えてください。あなたは「コンパイル」の設定に関連した依存関係を使用して、Antのパスを作成するためにcachepathタスクを使用していた
おかげ