maven

Edit

MAVEN : The Definitive Guide

시작하기

생성 mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=myapp

[Maven으로 프로젝트 빌드하기 (maven1)]

<dependency>
  <groupId>.....</groupId>
  <artifactId>.....</artifactId>
  <version>1.0.1</version>
  <scope>system</scope>
  <systemPath>${basedir}/lib/xss.jar</systemPath>
</dependency>

Effective pom : mvn help:effective-pom

Super pom

Options

  • -e : 발생한 error에 대해서 보여준다.
  • -X : Debug를 보여준다. 보통 이 옵션에 > log.log 처럼 파일로 내보내서 무슨 문제가 생겼는지 확인하면 좋다.
  • -U : 업데이트가 제대로 안되었을 경우 강제로 repository에서 업데이트 하도록한다.
  • -fn : 에러가 나던 말던 일단 빌드부터 하고 본다.
  • -P : 프로파일을 설정해서 하나의 프로젝트를 다른 설정으로 빌드할 수 있다.

기초개념

Dependency

Site

Plug-in

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <configuration>
  <archive>
    <manifest>
    <addClasspath>true</addClasspath>
    <mainClass>ca.sqlpower.architect.swingui.ArchitectFrame</mainClass>
    <classpathPrefix>lib/</classpathPrefix>
    </manifest>
    <manifestEntries>
      <Class-Path>jdbc/</Class-Path>
     </manifestEntries>
     </archive>
    </configuration>
</plugin>

exec plugin

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <phase>deploy</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <executable>/home1/irteam/bin/tomcat.sh</executable>
              <workingDirectory>/home1/irteam/bin</workingDirectory>
              <arguments>
                <argument>start</argument>
                <argument>buzz</argument>
              </arguments>
            </configuration>
          </plugin>

Resource Filter encoding 설정

             <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-resources-plugin</artifactId>
               <configuration>
                       <encoding>UTF-8</encoding>
                   </configuration>
               </plugin>

archetype

mvn install:install-file -Dfile=C:\aa.jar -DgroupId=aa -DartifactId=aa -Dversion=1.0 -Dpackaging=jar

mvn archetype:update-local-catalog

mvn archetype:generate

Children