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

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

sitelink1 http://blog.naver.com/pluggers/150003316374 
sitelink2  
sitelink3  

 

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

 

번호 제목 글쓴이 날짜 조회 수
39 Ant 로 Java Application 실행시 Target 에 파라미터를 입력하여 Arguments 로 전달하여 실행시키기 file 황제낙엽 2012.06.05 2020
38 Jenkins Rest API 사용기 file 황제낙엽 2020.03.26 859
» 1900개가 넘는 java컴파일시 Ant의 설정 황제낙엽 2007.02.28 678
36 ANT에서 Classpath 설정시 순서 주의 황제낙엽 2010.07.10 364
35 Eclipse 의 auto compile 과 ANT의 compile 황제낙엽 2007.02.28 279
34 [Maven] 로컬 레파지터리에 사용자 jar 추가하기 file 황제낙엽 2010.04.20 217
33 Maven 툴을 이용한 효율적인 프로젝트 관리 방안 황제낙엽 2007.01.30 148
32 Eclipse에서 Ant+xdoclet 를 이용한 web.xml, struts-config.xml 자동생성 황제낙엽 2007.03.03 125
31 Ant로 UTF-8 엔코딩하기 (프로젝트 변환) 황제낙엽 2007.07.03 73
30 Ant에서 "${java.class.path}"이 의미하는바 황제낙엽 2010.07.10 56
29 Jenkins의 Restful API file 황제낙엽 2020.08.11 50
28 jenkins에서 tfs에 접속하여 브랜치와 변경집합으로 소스를 다운로드하는 예제 황제낙엽 2020.08.11 44
27 Jenkins Restful API로 Job 과 Build 정보 조회 황제낙엽 2020.09.02 43
26 ANT 를 이용한 RMI 컴파일 ( rmic 로 stub 생성하기 ) 황제낙엽 2010.05.26 43
25 Ant 의 사용 용례와 사용법 file 황제낙엽 2007.07.16 39
24 [Jenkins] Java Sample with Jenkins Restful API 황제낙엽 2020.08.12 38
23 ANT 작성예제 (build.xml , build.properties) file 황제낙엽 2007.05.16 36
22 Jenkins 백업 (Thinbackup) file 황제낙엽 2021.07.22 28
21 Jenkins+TFS 연동 예제 황제낙엽 2020.09.01 28
20 Nexus Repository 황제낙엽 2020.05.20 28