앱)메이븐 maven pom.xml 예제

Posted by HULIA(휴리아)
2018. 1. 25. 16:10 백엔드개발/자바스프링
<project xmlns:"http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>Batch</groupId>
  <artifactId>Batch</artifactId>
  <version>1.0.0</version>

   <properties>
     <lib.dir>lib</lib.dir>
     <conf.dir>conf</conf.dir>
     <jar.name>JobManager</jar.name>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ch.qos.logback-version>1.1.7</ch.qos.logback.version>
<org.slf4j-version>1.7.21</org.slf4j-version>
<powermock.version>1.7.0</powermock.version>
<mockito.version>1.10.17</mockito.version>
<junit.version>4.12</junit.version>
<org.springframework-version>3.2.17.RELEASE</org.springframework-version>

<!-- slf4j와 logback과 상충된다-->
<org.logback-extensions-version>0.1.4</org.logback-extensions-version>
</properties>

<dependencies>
   <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>4.2.6.RELEASE</version>
       <exclusions>
           <exclusion>
               <groupdId>commons-logging</groupId>
               <artifactId>commons-logging</artifactId>
             </exclusion>
       </exclusions>

   </dependency>
   
   <dependency>
       <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>4.2.6.RELEASE</version>
</dependency>

<dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-context</artifactId>
   <version>4.2.6.RELEASE</version>
</depenency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-test</artifactId>
    <version>4.1.6.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.springframework.data</groupId>
 <artifactId>spring-data-commons<artifactId>
<version>1.11.4.RELEASE</version>
</dependecy>

<dependency>
   <groupId>mysql</groupId>
   <artifactId>mysql-connector-java</artifactId>
   <version>5.1.42</version>
</dependency>

<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.1.0</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.1.1</version>
</dependency>

<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>

<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.10</version>
</dependency>

<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.6</version>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${ch.qos.logback-version}</version>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${ch.qos.logback-version}</version>
</dependency>


<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j-version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j-version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>${powermock.version}</version>
<scope>test</test>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework-version}</version>
</dependency>

<!--logback 4개 대신에 요거 하나를 써도 된다 springframework에서는 -->
<dependency>
<groupId>org.logback-extensions</groupId>
<artifactId>logback-ext-spring</artifactId>
<version>${org.logback-extensions-version}</version>
</dependency>

<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
</dependency>

<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
</dependency>




</dependencies>


<build>
  <plugins>     
    <plugin>
     <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-comiler-plugin</artifactId>
      <version>3.1</version>
      <configuration>
       <source>1.7</source>
       <target>1.7</target>
       <encoding>UTF-8</encoding>
      </configuration>
    </plugin>


<plugin>
     <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-resources-plugin</artifactId>
      <version>2.4</version>
      <executions>
          <execution>
             <id>copy-resources-conf<id>
             <phase>prepare-package</phase>
             <goals><goal>copy-resources</goal></goals>
             <configuration>
                      <outputDirectory>${project.build.directory}/conf</outputDirectory>
        <resources><resource>
               <directory>src/main/resources</directory>
           </resource></resources>
         </configuration>
    </execution>
    <execution>
       <id>copy-resources-bin</id>
       <phase>prepare-package</phase>
        <goals><goal>copy-resources</goal></goals>
        <configuration>
             <outputDirectory>${project.build.directory}/bin</outputDirectory>
    <resources><resource>
             <directory>src/main/bin</directory>
       </resource></resources>
      </configuration>
      </execution>
     </executions>
   </plugin>


<plugin>
     <groupId>org.codehaus.mojo</groupId>
      <artifactId>build-helper-maven-plugin</artifactId>
      <version>1.11</version>
      <executions>
         <execution>
                 <id>timestamp-property</id>
                 <phase>validate</phase>
                <goals><goal>timestamp-property</goal></goals>
               <configuration>
                     <name>current.time</name>
                     <pattern>yyyyMMddHHmmss</pattern>
                 <locale>ko_KR</locale>
                 <timeZone>Asia/Seoul</timeZone>
             </configuration>
          </execution>
        </executions>
</plugin>




<plugin>
     <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <version>2.4</version>
      <configuration>
            <finalName>JobManager</finalName>
            <excludes>
                  <exclude>**/*.properties</exclude>
 <exclude>**/logback*.xml</exclude>
 <exclude>**/spring/**</exclude>
 <exclude>**/mybatis/**</exclude> 
</excludes>
<archive>
   <manifest>
        <addDefaultImplmentationEntries>true</addDefaultImplementationEntries>
<mainClass>com.test.jobmanager.JobManager</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>${lib.dir}/</classpathPrefix>
</manifest>
<manifestEntries>
<Class-Path>${conf.dir}/</Class-Path>
<Revision>${build.number}</Revision>
<Build-Date>${current.time}</Build-Date>
</manifestEntries>
</archive>
</configuration>
</plugin>




<plugin>
     <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-dependency-plugin</artifactId>
      <executions>
          <execution>
              <id>copy-dependencies</id>
              <phase>package</phase>
              <goals><goal>copy-dependencies</goal></goals>
            </execution>
         </executions>
         <configuraion>
               <outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
</configuraion>
</plugin>




<plugin>
     <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>2.4</version>
      <configuration>
          <descriptors><descriptor>src/main/assemblies/package.xml
          </descriptor></descriptors>
         <finalName>${project.artifactId}-${current.time}</finalName>
 <appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
   <execution>
      <id>tarball</id>
       <phase>package</phase>
       <goals><goal>single</goal><goals>
    </execution>
</executions>
</plugin>





<plugin>
     <groupId>org.codehaus.mojo</groupId>
      <artifactId>build.helper-maven-plugin</artifactId>
      <version>1.11</version>
      <executions>
          <execution>
              <id>timestamp-property</id>
              <phase>validate</phase>
              <goals><goal>timestamp-property</goal></goals>
          <configuraion>
              <name>current.time</name>
              <pattern>yyyyMMddHHmmss</pattern>
               <locale>ko_KR</locale>
               <timeZone>Asia/Seoul</timeZone>
          </configuraion>
          </execution>
       </executions>
</plugin>





<plugin>
     <groupId></groupId>
      <artifactId></artifactId>
      <version></version>






</plugin>




  </plugins>
  <pluginManagement>
      <plugins>
            <!-- This plugin's configuraion is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
       <plugin>
           <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
              <lifecycleMappingMetadata>
                  <pluginExecutions>
                      <pluginExecution>
                         <pluginExecutionFilter>
    <groupId>org.codehaus.mojo</groupId>
     <artifactId>build-helper-maven-plugin</artifactId>
      <versionRange>[1.11,)</versionRange>
       <goals><goal>timestamp-property</goal></goals>
  </pluginExecutionFilter>
<action><ignore /></action>
                     </pluginExecution>
                   </pluginExecutions>
</lifecycleMappingMetadata>
          </configuraion>
        </plugin>
       </plugins>
  </pluginManagement>
 

</build>
</project>