1. pom.xml 확인하고, 프로젝트\target\generated-source\archetype에서 deploy 하기
(1) pom.xml 확인
pom.xml 은 다음과 같은 형태음을 확인
<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>com.google.archetype</groupId>
<artifactId>maven-google-archetype</artifactId>
<version>1.7.0</version>
<packaging>maven-archetype</packaging>
<name>Maven Archetype for Google Web Application</name>
<inceptionYear>2011</inceptionYear>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
<version>2.0</version>
</extension>
</extensions>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-archetype-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<distributionManagement>
<repository>
........<비공개>
</repository>
<snapshotRepository>
.........<비공개>
</snapshotRepository>
</distributionManagement>
</project>
(2) deploy 한다.
프로젝트폴더\target\generated-sources\archetype>mvn deploy
(3) Build successful 뜨는지 확인
(내용을 보면 실제 deploy된 위치가 나옴)
2. 업로드 확인
위치 확인 http://서버이름/maven2/com/google/archetype/maven-google-archetype/
Index of /maven2/com/google/archetype/maven-google-archetype
Name Last modified Size
Parent Directory -
1.5.6/ 22-Apr-2010 18:32 -
1.7.0/ 14-Jan-2011 15:04 -
maven-metadata.xml 14-Jan-2011 15:04 377
maven-metadata.xml.md5 14-Jan-2011 15:04 32
maven-metadata.xml.sha1 14-Jan-2011 15:04 40
maven-metadata.xml3 14-Jan-2011 15:48 346
3. Maven 서버에 archetype 선택 메뉴 나오게 수정
[www@xsvn01.sps maven2]$ ls -al /home1/repository/maven2/archetype-catalog.xml
-rw-r--r-- 1 www www 1295 1¿u 14 16:01 /home1/repository/maven2/archetype-catalog.xml
<?xml version="1.0" encoding="UTF-8"?><archetype-catalog>
<archetypes>
<archetype>
<groupId>com.google.archetype</groupId>
<artifactId>maven-aaa-archetype</artifactId>
<version>2.5.1</version>
<repository>http://서버이름/maven2</repository>
<description>Maven Archetype for AAA Web Application</description>
</archetype>
<archetype>
<groupId>com.google.archetype</groupId>
<artifactId>maven-bbb-archetype</artifactId>
<version>2.3.2</version>
<repository>http://서버이름/maven2</repository>
<description>Maven Archetype for BBB Module</description>
</archetype>
<archetype>
<groupId>com.google.archetype</groupId>
<artifactId>maven-google-archetype</artifactId>
<version>1.5.6</version>
<repository>http://서버이름/maven2</repository>
<description>Maven Archetype for Google Web Application</description>
</archetype>
<!-- 추가된 부분 start-->
<archetype>
<groupId>com.google.archetype</groupId>
<artifactId>maven-google-archetype</artifactId>
<version>1.7.0</version>
<repository>http://서버이름/maven2</repository>
<description>Maven Archetype for Google Web Application</description>
</archetype>
<!-- 추가된 부분 end-->
</archetypes>
</archetype-catalog>
4. 확인
mvn archetype:generate -DarchetypeCatalog=http://서버이름/maven2
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from google repository
[INFO] org.codehaus.mojo: checking for updates from goggle repository
[INFO] artifact org.apache.maven.plugins:maven-archetype-plugin: checking for up
dates from goggle repository
[INFO] ------------------------------------------------------------------------
[INFO] Building google 1.7 example
[INFO] task-segment: [archetype:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] [archetype:generate {execution: default-cli}]
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.
archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: http://서버이름/maven2 -> maven-aaa-archetype (Maven Archetype for US
F Web Application)
2: http://서버이름/maven2 -> maven-bbb-archetype (Maven Archetype for B
LOC Module)
3: http://서버이름/maven2 -> maven-google-archetype (Maven Archetype for Google Web Application)
Choose a number: : 3
Choose version:
1: 1.5.6
2: 1.7.0
Choose a number: : 2
5. 예외 케이스
[ERROR] org.apache.maven.archetype.exception.InvalidPackaging: Unable to add module to the current project as it is not of packaging type 'pom'
org.apache.maven.archetype.exception.ArchetypeGenerationFailure: org.apache.maven.archetype.exception.InvalidPackaging: Unable to add module to the current project as it is not of packaging type 'pom'
만약 archetype을 받는데, 위의 exception이 난다고 하면, 클라인언트 디렉토리에 이미 존재했을 수 있음..
다른 디렉토리에 해서 받으면 ok됨
* 직접 다운받기
과정없이 직접 archetype을 다운받는 방법
mvn archetype:generate -DarchetypeCatalog=http://서버위치/maven2 -DarchetypeGroupId=com.google.archetype -DarchetypeArtifactId=maven-goggle-archetype -DarchetypeVersion=1.7.0
'etc tools' 카테고리의 다른 글
[maven2] 관련 lib들을 하나의 jar로 묶어주기 - assembly (0) | 2011.02.28 |
---|---|
[Maven Deploy 툴 Nexus 활용] (0) | 2011.02.09 |
JUNIT4 Suite -> ClasspathSuite (0) | 2010.09.01 |
[ANT] fixcrlf (0) | 2010.07.29 |
maven의 exclusion 고민 (0) | 2010.07.21 |