티스토리 뷰

maven pom 속성정리 - Build Settings 속성 예제 및 설명

<build>
    <defaultGoal>install</defaultGoal>
    <directory>${basedir}/target</directory>
    <finalName>${artifactId}-${version}</finalName>
    <filters>
        <filter>filtes/filter1.properties</filter>
    </filters>
 
    <sourceDirectory>src/main/java</sourceDirectory>
    <testSourceDirectory>src/test/java</testSourceDirectory>
    <outputDirectory>target/classes</outputDirectory>
    <testOutputDirectory>target/test-classess</testOutputDirectory>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
        </resource>
        <resource>
            <targetPath>META-INF/plexus</targetPath>
            <filtering>false</filtering>
            <directory>${basedir}/src/main/plexus</directory>
            <includes>
                <include>configuration.xml</include>
            </includes>
            <excludes>
                <exclude>**/*.properties</exclude>
            </excludes>
        </resource>
    </resources>
    <testResources>
        <testResource>
            <directory>src/test/resource</directory>
        </testResource>
    </testResources>
 
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>



<build>                   : 소스 디렉토리구조, 빌드 산출물 디렉토리 구조, 빌드시 사용할 플러그인 정보 관리
    <defaultGoal>         : 아무것도 지정하지 않은 goal의 실행시 실행되는 목표(install, clean, package, build등)
    <directory>           : 빌드시 생성되는 파일의 위치
    <finalName>           : 최종 빌드시 생성되는 프로젝트 이름
    <filter>              : 설정을 허용하는 리소스에 적용되는 속성 (*.properties로 정의)
                          resource의 임의이 파일에 ${name}을 적용하면 필터의 propertise 에 name을 정의하여 사용할수 있다
                          
    <sourceDirectory>     : 자바 소스 코드를 관리하는 디렉토리
    <testSourceDirectory> : 테스트 소스를 관리하기 위한 디렉토리
    <outputDirectory>     : sourceDirectory의 소스를 컴파일한 결과물이 위치하는 디렉토리
    <testOutputDirectory> : testSourceDirectory의 소스를 컴파일한 결과물이 위치하는 디렉토리
    <resources>           : 서비스에 사용되는 자원을 관리하는 디렉토리
        <targetPath>      : 빌드에서 리소스 세트를 배치 할 디렉토리 구조를 지정(일반적으로 META-INF)
        <filtering>       : filter를 사용할지 여부를 판단 true/false
        <directory>       : 자원을 찾는 위치 (기본 src/main/resouece)
        <includes>        : 디렉토리에서 자원으로 포함될 파일 패턴
        <excludes>        : 자원에서 제외할 파일 패턴
    <testResources>       : 테스트시 사용되는 자원을 관리하는 디렉토리
    
    <plugins>             : 메이븐에서 제공하는 모든 기능은 플러그인을 기반으로 동작한다
                            메이븐 페이즈 또한 플러그인을 통하여 실행된다
                            (페이즈 : 라이프사이클의 빌드 단계-compile, test, package, install, deply)
                            메이븐 플러그인은 하나의 플러그인에서 여러 작업을 수행할 수 있으며 각각의 작업을 골(goal)이라 한다
 
                            예를 들면 maven-compiler-plugin 플러그인은 하나지만 이 플러그인이 지원하는 골은 
                            sourceDirectory의 소스 코드를 컴파일 하는 compiler:compile골
                            (groupId가 org.apache.maven.plugins, artifactId가 maven-compiler-plugin 인 플러그인인
                            compile 골을 실행한다는 뜻이다)
                            testSourceDirectory의 테스트 코드를 컴파일 하는 compiler:testCompile골등이 있다
                            플러그인이 어떤 역할을 하는지만 이해하기 바란다
                            
                            플러그인의 기능에 따라 종류가 많기 때문에 아래 사이트를 참고하기 바란다
                            http://maven.apache.org/plugins/index.html



댓글
공지사항