Ant 1900개가 넘는 java컴파일시 Ant의 설정

황제낙엽 2007.02.28 10:43 조회 수 : 1888 추천:73

 

2000개가 넘는 자바파일을 Ant로 컴파일 시킬려면..

compile:
     [echo] Compile Start !! --- 2006-04-10 05:16:33
    [javac] Compiling 2144 source files to C:lafBuilderworkspaceRmsWEB-INFclasses
    [javac] java.lang.OutOfMemoryError
    [javac] Exception in thread "main"

BUILD FAILED
C:lafBuilderworkspaceRmsbuild.xml:33: Compile failed; see the compiler error output for details.

위와 같은 에러메시지가 난다.. OutOfMemoryError 젠장..

이럴때 Ant의 javac 프라퍼티에 fork="yes" memoryMaximumSize="256m" 추가해서 컴파일 하면 된다.

Parameters

 

Attribute Description Required
srcdir Location of the java files. (See the note below.) Yes, unless nested elements are present.
destdir Location to store the class files. No
includes Comma- or space-separated list of files (may be specified using wildcard patterns) that must be included; all .java files are included when omitted. No
includesfile The name of a file that contains a list of files to include (may be specified using wildcard patterns). No
excludes Comma- or space-separated list of files (may be specified using wildcard patterns) that must be excluded; no files (except default excludes) are excluded when omitted. No
excludesfile The name of a file that contains a list of files to exclude (may be specified using wildcard patterns). No
classpath The classpath to use. No
sourcepath The sourcepath to use; defaults to the value of the srcdir attribute (or nested elements). To suppress the sourcepath switch, use sourcepath="". No
bootclasspath Location of bootstrap class files. No
classpathref The classpath to use, given as a reference to a path defined elsewhere. No
sourcepathref The sourcepath to use, given as a reference to a path defined elsewhere. No
bootclasspathref Location of bootstrap class files, given as a reference to a path defined elsewhere. No
extdirs Location of installed extensions. No
encoding Encoding of source files. (Note: gcj doesn't support this option yet.) No
nowarn Indicates whether the -nowarn switch should be passed to the compiler; defaults to off. No
debug Indicates whether source should be compiled with debug information; defaults to off. If set to off, -g:none will be passed on the command line for compilers that support it (for other compilers, no command line argument will be used). If set to true, the value of the debuglevel attribute determines the command line argument. No
debuglevel Keyword list to be appended to the -g command-line switch. This will be ignored by all implementations except modern, classic(ver >= 1.2) and jikes. Legal values are none or a comma-separated list of the following keywords: lines, vars, and source. If debuglevel is not specified, by default, nothing will be appended to -g. If debug is not turned on, this attribute will be ignored. No
optimize Indicates whether source should be compiled with optimization; defaults to off. No
deprecation Indicates whether source should be compiled with deprecation information; defaults to off. No
target Generate class files for specific VM version (e.g., 1.1 or 1.2). Note that the default value depends on the JVM that is running Ant. In particular, if you use JDK 1.4+ the generated classes will not be usable for a 1.1 Java VM unless you explicitly set this attribute to the value 1.1 (which is the default value for JDK 1.1 to 1.3). We highly recommend to always specify this attribute. No
verbose Asks the compiler for verbose output; defaults to no. No
depend Enables dependency-tracking for compilers that support this (jikes and classic). No
includeAntRuntime Whether to include the Ant run-time libraries in the classpath; defaults to yes. No
includeJavaRuntime Whether to include the default run-time libraries from the executing VM in the classpath; defaults to no. No
fork Whether to execute javac using the JDK compiler externally; defaults to no. No
executable Complete path to the javac executable to use in case of fork="yes". Defaults to the compiler of the Java version that is currently running Ant. Ignored if fork="no".
Since Ant 1.6 this attribute can also be used to specify the path to the executable when using jikes, jvc, gcj or sj.
No
memoryInitialSize The initial size of the memory for the underlying VM, if javac is run externally; ignored otherwise. Defaults to the standard VM memory setting. (Examples: 83886080, 81920k, or 80m) No
memoryMaximumSize The maximum size of the memory for the underlying VM, if javac is run externally; ignored otherwise. Defaults to the standard VM memory setting. (Examples: 83886080, 81920k, or 80m) No
failonerror Indicates whether the build will continue even if there are compilation errors; defaults to true. No
source Value of the -source command-line switch; will be ignored by all implementations prior to javac1.4 (or modern when Ant is not running in a 1.3 VM) and jikes.
If you use this attribute together with jikes, you must make sure that your version of jikes supports the -source switch. By default, no -source argument will be used at all.
Note that the default value depends on the JVM that is running Ant. We highly recommend to always specify this attribute.
No
compiler The compiler implementation to use. If this attribute is not set, the value of the build.compiler property, if set, will be used. Otherwise, the default compiler for the current VM will be used. (See the above list of valid compilers.) No
listfiles Indicates whether the source files to be compiled will be listed; defaults to no. No
tempdir Where Ant should place temporary files. This is only used if the task is forked and the command line args length exceeds 4k. Since Ant 1.6. No; default is java.io.tmpdir.

출처 : http://ant.apache.org/manual/CoreTasks/javac.html

<target name="compile" depends="init">
    <echo message="Compile Start!! --- ${TODAY}" />
    <javac srcdir="${src.dir}" for="yes" memoryMaximumSize="256m" destdir="${classes.dir}">
        <classpath>
            <pathelement location="..." />
            <pathelement location="..." />
            <pathelement location="..." />
            <pathelement location="..." />
        </classpath>
    </javac>
    <echo message="Compile End!! --- ${TODAY}" />
</target>


compile:
     [echo] Compile Start !! --- 2006-04-10 05:19:48
    [javac] Compiling 2144 source files to C:lafBuilderworkspaceRmsWEB-INFclasses
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -deprecation for details.
     [echo] Compile End !!   --- 2006-04-10 05:19:48
BUILD SUCCESSFUL
Total time: 19 seconds

 

번호 제목 글쓴이 날짜 조회 수
49 GitHub, SourceTree, Gradle, Eclipse 환경의 java project 생성하기 절차 황제낙엽 2025.08.26 252
48 eclipse 용 gradle web application project (no spring) 생성하기 황제낙엽 2025.05.04 317
47 라이브러리 개발 프로젝트에서 jar 로 build 후 파일을 특정 로컬 경로로 copy 하는 예제 황제낙엽 2025.02.07 294
46 [Gemini] gradle init 으로 프로젝트 생성하는 절차 내용 황제낙엽 2025.01.24 344
45 [ChatGPT] eclipse 의 web project 에서 gradle refresh 때마다 context root 가 초기화 황제낙엽 2024.11.14 375
44 Gretty, Jetty 에서 ssl 적용 황제낙엽 2024.11.12 414
43 [ChatAI] Gradle Wrapper의 버전을 업그레이드하는 절차 황제낙엽 2024.11.12 458
42 eclipse 용 gradle web application sample project (no spring) file 황제낙엽 2024.11.12 374
41 [phind] Gradle 프로젝트를 생성할 때 nested sub project 가 함께 생성되는 이유 황제낙엽 2024.11.12 362
40 IDE(IntelliJ, Android Studio, Eclipse) 에서 build.gradle 에 dependencies 추가후 의존 라이브러리 갱신하기 황제낙엽 2024.10.30 379
39 [POST, 2021.06.28] Gradle을 이용해 Web 어플리케이션을 만들고 빌드하고 실행하기 file 황제낙엽 2023.12.30 330
38 build.gradle 의 dependencies 황제낙엽 2023.12.29 327
37 error: unmappable character 황제낙엽 2023.12.29 326
36 Task :compileJava FAILED 황제낙엽 2023.12.29 349
35 사용자 라이브러리 파일(*.jar) 를 의존성에 추가하는 방법 황제낙엽 2023.12.28 361
34 Windows 에 Gradle 설치 황제낙엽 2023.12.23 347
33 Eclipse, Gradle 프로젝트 생성, Dynamic Web Project 로 변경 황제낙엽 2023.12.23 362
32 Eclipse 에서 Gradle Project 를 WAR 로 배포하기 황제낙엽 2023.12.01 538
31 Eclipse 에서 생성한 Gradle Project 를 리프레쉬 했을때 주의할 점 황제낙엽 2023.11.30 1532
30 Gradle 기본 다지기 1편 file 황제낙엽 2023.11.16 244