1.7.0 뿐만 아니라 다른 버전도 멈춰서네요.

Downloading: http://maven.springframework.org/milestone/org/aspectj/aspectjtools/1.7.0.RC1/aspectjtools-1.7.0.RC1.pom

Downloaded: http://maven.springframework.org/milestone/org/aspectj/aspectjtools/1.7.0.RC1/aspectjtools-1.7.0.RC1.pom (862 B at 1.2 KB/sec)

Downloading: http://maven.springframework.org/release/org/aspectj/aspectjtools/1.7.0.RC1/aspectjtools-1.7.0.RC1.jar

Downloading: http://maven.springframework.org/milestone/org/aspectj/aspectjtools/1.7.0.RC1/aspectjtools-1.7.0.RC1.jar

390KB

^C

망을 바꿔서 다시 시도하니 됩니다.

kenuui-Retina-MacBook-Pro:petclinic kenu$ mvn package

[INFO] Scanning for projects...

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] Building petclinic 0.1.0.BUILD-SNAPSHOT

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] --- aspectj-maven-plugin:1.2:compile (default) @ petclinic ---

Downloading: http://maven.springframework.org/milestone/org/aspectj/aspectjtools/1.7.0.RC1/aspectjtools-1.7.0.RC1.jar

pom.xml에 다음 코드를 추가하면 mvn tomcat:run 으로 프로젝트를 실행할 수 있습니다. 설치된 톰캣이 없어도 톰캣은 자동으로 다운로드합니다.

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat6-maven-plugin</artifactId>
          <version>2.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat7-maven-plugin</artifactId>
          <version>2.1</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

from: http://tomcat.apache.org/maven-plugin-2.1/



[INFO] [war:war {execution: default-war}]
[INFO] Packaging webapp
[HUDSON] Archiving C:\eGovFrameSvr\hudson\jobs\ok.egov\workspace\pom.xml to C:\eGovFrameSvr\hudson\jobs\ok.egov\modules\ok$egov\builds\2013-07-02_07-12-51\archive\ok\egov\1.0.0\pom.xml
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
---- Debugging information ----
message             : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
cause-exception     : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message       : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
class               : org.apache.maven.plugin.war.util.WebappStructure
required-type       : org.apache.maven.plugin.war.util.WebappStructure
path                : /webapp-structure
line number         : 1
-------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Trace
com.thoughtworks.xstream.converters.ConversionException: Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
---- Debugging information ----
message             : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
cause-exception     : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message       : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
class               : org.apache.maven.plugin.war.util.WebappStructure
required-type       : org.apache.maven.plugin.war.util.WebappStructure
path                : /webapp-structure
line number         : 1
-------------------------------
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:63)
	at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:117)
	...
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)
Caused by: com.thoughtworks.xstream.converters.reflection.ObjectAccessException: Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
	at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.newInstance(PureJavaReflectionProvider.java:59)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:257)
	at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:124)
	at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56)
	... 43 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Tue Jul 02 07:12:57 KST 2013
[INFO] Final Memory: 20M/49M
[INFO] ------------------------------------------------------------------------
channel stopped
Finished: FAILURE


이 에러 메시지는 maven war plugin 이 Java7을 지원하지 못하기 때문이라고 합니다. jdk1.6으로 내리거나 아래 플러그인을 pom.xml에 추가해야 합니다.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
</plugin>

from: http://stackoverflow.com/questions/7539970/cannot-construct-org-apache-maven-plugin-war-util-webappstructure-as-it-does-not




가상머신에서 ~/.m2/repository 를 찾지 못하는 경우입니다. 




C:\Users\kenu>mvn clean

[ERROR] Could not create local repository at \\vmware-host\Shared Folders\.m2\repository -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LocalRepositoryNotAccessibleException


Git Bash를 통해서 mvn 의 경로를 찾았습니다. 제 경우 mvn이 세 가지 이상 설치되었기 때문이죠. Path 환경변수를 확인해도 될 것입니다.

which mvn


해당 maven의 conf폴더에 있는 settings.xml 파일을 다음과 같이 수정했습니다.


<!-- localRepository

   | The path to the local repository maven will use to store artifacts.

   |

   | Default: ~/.m2/repository

  -->

  <localRepository>~/.m2/repository</localRepository>


이후 잘 동작합니다.

10/04일에 maven 3.0이 나왔습니다. http://maven.apache.org/
가볍게 2.8M의 파일을 받아서 압축을 풀었습니다. /home/kenu/java/apache-maven-3.0/

환경변수 $PATH에 maven실행파일 경로를 추가했습니다.
JAVA_HOME=/home/kenu/java/jdk1.6.0_18
PATH=$PATH:$JAVA_HOME/bin:/home/kenu/java/apache-maven-3.0/bin
export JAVA_HOME
export PATH

환경변수를 적용하고, mvn 버전을 확인합니다.
$. ~/.profile
$mvn -version
Apache Maven 3.0 (r1004208; 2010-10-04 20:50:56+0900)
Java version: 1.6.0_18
Java home: /home/kenu/java/jdk1.6.0_18/jre
Default locale: ko_KR, platform encoding: UTF-8
OS name: "linux" version: "2.6.32-25-generic" arch: "amd64" Family: "unix"

설치는 잘 되었습니다.
샘플 프로젝트를 만들어봅니다. phase는 generate , groupId는 com.mycompany.app, artifactId는 my-app 정도가 됩니다.
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

이렇게 만들어집니다.
kenu@kenu-ubuntu:~/maven$ cd my-app
kenu@kenu-ubuntu:~/maven/my-app$ tree
.
|-- pom.xml
`-- src
    |-- main
    |   `-- java
    |       `-- com
    |           `-- mycompany
    |               `-- app
    |                   `-- App.java
    `-- test
        `-- java
            `-- com
                `-- mycompany
                    `-- app
                        `-- AppTest.java


이제 컴파일하고 빌드를 해봅니다.
mvn package

경로를 바꾸고 실행은 다음과 같이 할 수 있습니다.
java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
Hello World!

설치는 잘 되었습니다.
사용자 홈 디렉토리 아래 .m2 라는 폴더가 생겨서 여기에 다운로드되는 파일들이 많이 있습니다. 로컬 캐시역할을 하기 때문에 처음 실행시에는 시간이 많이 걸립니다.

Ant를 넘어서 maven으로 갈아탈 준비중입니다.

+ Recent posts