Buildr의 기본 프로젝트 구조는 Maven2의 그것과 거의 동일합니다.
Maven에서 기본 프로젝트 디렉토리 구조를 아래처럼 세팅하여 변경할 수 있었습니다.
(위에서 :htdocs는 제가 임의로 사용한 심볼입니다)
src
|__main
| |__java <-- Source files to compile
| |__resources <-- Resources to copy
| |__webapp <-- For WARs
|__test
| |__java <-- Source files to compile (tests)
| |__resources <-- Resources to copy (tests)
target <-- Packages created here
|__classes <-- Generated when compiling
|__resources <-- Copied (and filtered) from resources
|__test/classes <-- Generated when compiling tests
|__test/resources <-- Copied (and filtered) from resources
reports <-- Test, coverage and other reports
|__main
| |__java <-- Source files to compile
| |__resources <-- Resources to copy
| |__webapp <-- For WARs
|__test
| |__java <-- Source files to compile (tests)
| |__resources <-- Resources to copy (tests)
target <-- Packages created here
|__classes <-- Generated when compiling
|__resources <-- Copied (and filtered) from resources
|__test/classes <-- Generated when compiling tests
|__test/resources <-- Copied (and filtered) from resources
reports <-- Test, coverage and other reports
Maven에서 기본 프로젝트 디렉토리 구조를 아래처럼 세팅하여 변경할 수 있었습니다.
<build>
<directory>target</directory>
<sourceDirectory>src</sourceDirectory>
<outputDirectory>web/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
... ....
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-alpha-2</version>
<configuration>
<warSourceDirectory>web</warSourceDirectory>
<webappDirectory>${project.build.directory}/webapp</webappDirectory>
</configuration>
</plugin>
<directory>target</directory>
<sourceDirectory>src</sourceDirectory>
<outputDirectory>web/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
... ....
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-alpha-2</version>
<configuration>
<warSourceDirectory>web</warSourceDirectory>
<webappDirectory>${project.build.directory}/webapp</webappDirectory>
</configuration>
</plugin>
Buildr도 디렉토리 구조를 바꿀 수 있습니다. 프로젝트 정의 메소드에 Layout 인스턴스를 전달해주면 됩니다.
( http://incubator.apache.org/buildr/extending.html#using_alternative_layouts )
my_layout = Layout.new
my_layout[:source, :main, :java] = 'src'
my_layout[:source, :main, :resources] = 'src'
my_layout[:source, :test, :java] = 'test'
my_layout[:source, :test, :resources] = 'test'
my_layout[:source, :main, :webapp] = 'web'
my_layout[:target, :main, :classes] = 'web/WEB-INF/classes'
my_layout[:target, :main, :resources] = 'web/WEB-INF/classes'
my_layout[:target, :test, :classes] = 'target/test-classes'
my_layout[:target, :test, :resources] = 'target/test-classes'
my_layout[:target, :main, :webapp] = 'target/webapp'
my_layout[:target, :main, :htdocs] = 'target/htdocs'
my_layout[:reports] = 'target/reports'
define "MyProject", :layout=>my_layout do
my_layout[:source, :main, :java] = 'src'
my_layout[:source, :main, :resources] = 'src'
my_layout[:source, :test, :java] = 'test'
my_layout[:source, :test, :resources] = 'test'
my_layout[:source, :main, :webapp] = 'web'
my_layout[:target, :main, :classes] = 'web/WEB-INF/classes'
my_layout[:target, :main, :resources] = 'web/WEB-INF/classes'
my_layout[:target, :test, :classes] = 'target/test-classes'
my_layout[:target, :test, :resources] = 'target/test-classes'
my_layout[:target, :main, :webapp] = 'target/webapp'
my_layout[:target, :main, :htdocs] = 'target/htdocs'
my_layout[:reports] = 'target/reports'
define "MyProject", :layout=>my_layout do
project.version = VERSION_NUMBER
project.group = GROUP
manifest["Implementation-Vendor"] = COPYRIGHT
... ...
resources.exclude '**/*.java'
test.resources.exclude '**/*.java'
... ...
end
(위에서 :htdocs는 제가 임의로 사용한 심볼입니다)
'Build&Deploy > Buildr' 카테고리의 다른 글
Buildr : 리소스 필터링 (0) | 2008.12.09 |
---|---|
Buildr : 파일집합 복사하기 (0) | 2008.12.05 |
Buildr : 파일 집합 선택 (0) | 2008.12.01 |
Buildr : 의존성(dependencies) 설정하기 (4) | 2008.11.19 |
Buildr : 컴파일 옵션 설정하기 (2) | 2008.11.18 |