본문 바로가기

카테고리 없음

Maven Commend

반응형

MavenCommend

Basic Commend

  • Version

D:\temp>mvn -version
Maven version: 2.0.9
Java version: 1.6.0_04
OS name: "windows 2003" version: "5.2" arch: "x86" Family: "windows"
  • Maven Java 프로젝트 생성

D:\temp>mvn archetype:create -DgroupId=net.clt.app -DartifactId=myapp
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:create] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] [archetype:create]
[WARNING] This goal is deprecated. Please use mvn archetype:generate instead
[INFO] Defaulting package to group ID: net.clt.app
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating OldArchetype: maven-archetype-quickstart:RELEASE
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: net.clt.app
[INFO] Parameter: packageName, Value: net.clt.app
[INFO] Parameter: package, Value: net.clt.app
[INFO] Parameter: artifactId, Value: myapp
[INFO] Parameter: basedir, Value: D:\temp
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] ********************* End of debug info from resources from generated POM ***********************
[INFO] OldArchetype created in dir: D:\temp\myapp
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Tue May 06 17:21:54 KST 2008
[INFO] Final Memory: 8M/15M
[INFO] ------------------------------------------------------------------------
  • Compile

D:\temp\myapp>mvn compile
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building myapp
[INFO]    task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Compiling 1 source file to D:\temp\myapp\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue May 06 17:39:52 KST 2008
[INFO] Final Memory: 5M/10M
[INFO] ------------------------------------------------------------------------
  • Test Compile

D:\temp\myapp>mvn test-compile
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building myapp
[INFO]    task-segment: [test-compile]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Compiling 1 source file to D:\temp\myapp\target\test-classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Tue May 06 17:40:48 KST 2008
[INFO] Final Memory: 5M/10M
[INFO] ------------------------------------------------------------------------
  • Compile 한 구현 Code 압축 하기

D:\temp\myapp>mvn package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building myapp
[INFO]    task-segment: [package]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Surefire report directory: D:\temp\myapp\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running net.clt.app.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] [jar:jar]
[INFO] Building jar: D:\temp\myapp\target\myapp-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Tue May 06 17:41:59 KST 2008
[INFO] Final Memory: 7M/13M
[INFO] ------------------------------------------------------------------------
  • Local Repository 에 등록 하기

D:\temp\myapp>mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building myapp
[INFO]    task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Surefire report directory: D:\temp\myapp\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running net.clt.app.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] [jar:jar]
[INFO] [install:install]
[INFO] Installing D:\temp\myapp\target\myapp-1.0-SNAPSHOT.jar to C:\Documents and Settings\Administrator\.m2\repository\net\clt\app\myapp\1.0-SNAPSHOT\myapp-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Tue May 06 17:43:03 KST 2008
[INFO] Final Memory: 8M/16M
[INFO] ------------------------------------------------------------------------
  • 배포.. Deploy 공유..

D:\temp\myapp>mvn deploy
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building myapp
[INFO]    task-segment: [deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Surefire report directory: D:\temp\myapp\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running net.clt.app.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] [jar:jar]
[INFO] [install:install]
[INFO] Installing D:\temp\myapp\target\myapp-1.0-SNAPSHOT.jar to C:\Documents and Settings\Administrator\.m2\repository\
net\clt\app\myapp\1.0-SNAPSHOT\myapp-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for: org.apache.maven.plugins:maven-deploy-plugin:2.3

check that the following section of the pom.xml is present and correct:

<distributionManagement>
  <!-- use the following if you're not using a snapshot version. -->
  <repository>
    <id>repo</id>
    <name>Repository Name</name>
    <url>scp://host/path/to/repo</url>
  </repository>
  <!-- use the following if you ARE using a snapshot version. -->
  <snapshotRepository>
    <id>repo</id>
    <name>Repository Name</name>
    <url>scp://host/path/to/repo</url>
  </snapshotRepository>
</distributionManagement>

Cause: Class 'org.apache.maven.artifact.repository.ArtifactRepository' cannot be instantiated
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue May 06 17:53:39 KST 2008
[INFO] Final Memory: 8M/15M
[INFO] ------------------------------------------------------------------------

-- 중간에 보면 Error 가 났다. 아마도 어디에다가 deploy를 해야 하는지 안적어서 인듯 한데.. 암튼 나중에 생각하자.

Extension Commend

  • Eclipse Project로 변환하기

D:\temp\myapp>mvn eclipse:eclipse
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'eclipse'.
[INFO] ------------------------------------------------------------------------
[INFO] Building myapp
[INFO]    task-segment: [eclipse:eclipse]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing eclipse:eclipse
[INFO] No goals needed for project - skipping
[INFO] [eclipse:eclipse]
[INFO] Using as WTP server : null
[INFO] Adding default classpath contaigner: org.eclipse.jdt.launching.JRE_CONTAINER
[INFO] Using source status cache: D:\temp\myapp\target\mvn-eclipse-cache.properties
[INFO] Not writing settings - defaults suffice
[INFO] Wrote Eclipse project for "myapp" to D:\temp\myapp.
[INFO]
       Sources for some artifacts are not available.
       Please run the same goal with the -DdownloadSources=true parameter in order to check remote repositories for sources.
       List of artifacts without a source archive:
         o junit:junit:3.8.1

       Javadoc for some artifacts is not available.
       Please run the same goal with the -DdownloadJavadocs=true parameter in order to check remote repositories for javadoc.
       List of artifacts without a javadoc archive:
         o junit:junit:3.8.1

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue May 06 18:00:03 KST 2008
[INFO] Final Memory: 5M/10M
[INFO] ------------------------------------------------------------------------
  • Eclipse의 Import의 Existing Projects into Workspace를 이용하여 Eclipse 프로젝트로 등록 할 수 있다.
  • Maven의 Repository Classpath를 추가한다.

mavenRepo.JPG

반응형