当前位置: 代码迷 >> CVS/SVN >> mvn+svn+linux封装
  详细解决方案

mvn+svn+linux封装

热度:4404   发布时间:2013-02-26 00:00:00.0
mvn+svn+linux打包

?

背景:基于assemblysvn安装参考上篇

准备

apache-maven-2.2.1-bin.zip(可从附件中下载)

?

1、安装svn

参照上篇

?

2、解压mvn

?

Unzip apache-maven-2.2.1-bin.zip /usr/maven

?

3、打包shell

?

#!/bin/bash

cd /usr/package/build002000

?

svn co --username XXX --password XXX https://192.168.1.165/svn/********

?

M2_HOME=/usr/maven/

export M2_HOME

?

PATH="$PATH":/usr/svn/bin:/usr/maven/bin

export PATH

?

cd XXX

bash -x mvn clean package -Dmaven.test.skip=true

mv? target/*.war? ../

mv? DB? ../DB

cd ..

rm -rf XXX

md5sum *.war>>XXX.md5

cd ..

tar czvf XXXX_build002000_20110712.tar.gz build002000

?

遇到问题

Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher

?

解决一(来源网上)

A search on the internet suggested other people had a similar problem which may or may not be solved by setting M2_HOME and/or JAVA_HOME correctly. For me, this didn't help. I worked out the problem by editing /usr/share/bin/mvn and seeing the command it was trying to run:

?

?exec "$JAVACMD" \

? $MAVEN_OPTS \

? -classpath "${M2_HOME}"/boot/classworlds*.jar \

? "-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \

? "-Dmaven.home=${M2_HOME}"? \

? ${CLASSWORLDS_LAUNCHER} $QUOTED_ARGS

?

From this I learned, that it was looking in /usr/share/maven/boot for a jar but this folder was empty on my system. Next, I used "locate classworlds.jar" to find out if this file existed and sure enough it did. In the end the solution was this:

?

su - root

cd /usr/share/maven2/boot

ln -s /usr/share/java/classworlds.jar

?

?

解决二

shell中指定M2_HOME

?

M2_HOME=/usr/maven/

export M2_HOME

?