놀랍게도 Java 용 Eclipse (Neon)에서 생성 한 build.xml
파일에는 jar
작업의 호출이 포함 된 요소가 없습니다. 코드 생성의 경우가 종종 그렇듯이 코드 생성을 완전히 재현하거나 회피 할 수 있도록 코드를 사용하고 편집하지 않아야한다고 생각합니다. 생성 된 파일의 주석은 가져 오기를 통해 기능을 확장하여 편집을 피할 수 있음을 나타냅니다. 이클립스 생성 된 개미 스크립트로 jar 파일을 만드는 방법은 무엇입니까?
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. -->
은 내가
export.xml
라는 두 번째 파일에
<?eclipse.ant.import?>
요소를 사용할 수있을 것이라고 생각했다.
ant
스크립팅에는 빌드 파일 당 하나의 프로젝트가 있어야하므로 첫 번째 프로젝트의 대상에 종속 된 두 번째 프로젝트가 있습니다.
재생성 build.xml
은 "가져 오기"가 예상대로 포함되어 있음을 나타냅니다.
<import file="export.xml"/>
불행하게도이 작동하지 않습니다. 명령 줄에서 실행하는 ant
을 실행하면 내보내기/jar
프로젝트가 무시되는 결과가 나타나는 것 같습니다.
(7 줄에 중첩 된) 수입 요소와 생성 된 스크립트는 ...
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="ohana1">
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.8"/>
<property name="source" value="1.8"/>
<import file="export.xml"/>
<path id="ohana1.classpath">
<pathelement location="bin"/>
<pathelement location="../export/ohana1/commons-collections-3.2.1.jar"/>
</path>
<target name="init">
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="bin"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="build-subprojects,build-project" name="build"/>
<target name="build-subprojects"/>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="ohana1.classpath"/>
</javac>
</target>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
<target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
<copy todir="${ant.library.dir}">
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</copy>
<unzip dest="${ant.library.dir}">
<patternset includes="jdtCompilerAdapter.jar"/>
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</unzip>
</target>
<target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<antcall target="build"/>
</target>
</project>
export.xml
파일은 jar
...
<?eclipse.ant.import?>
<project basedir="." default="export" name="ohana1Export">
<target depends="build,make-jar" name="export"/>
<target name="make-jar">
<jar destfile="../export/ohana1/${ant.project.name}.jar" basedir="bin"/>
</target>
</project>
참고을 의미 이클립스 이 프로젝트/buildfile에 종속성 인 build
이라는 대상이 없기 때문에 Ant 편집기는이 export.xml
파일에 대해 불평합니다. build
타겟은 생성 된 build.xml
에 있습니다. 그 오류는 "멍청한"편집인이 올 수 있으므로 ant
을 실행하기 위해 계속 진행했습니다. 명령 줄에서 ant
을 호출하면 jar
파일이 만들어지지 않습니다.
난 당신이 .jar
파일을 내보내고 인간의 모든 요구 사항을 충족 ant
스크립트를 유지해야 할 필요가있는 경우 Eclipse의 ant
스크립트 생성기는 쓸모없는 결론을해야 하는가?