Monday, August 30, 2010

maven:install在命令行构建成功而m2eclipse中构建失败

在命令行中用
$> mvn package
能构建成功,但在eclipse中用m2eclipse插件则构建失败,提示信息摘录部分如下:
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] dependenciesInfo : dependenciesInfo
---- Debugging information ----
message : dependenciesInfo : dependenciesInfo
cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message : dependenciesInfo : dependenciesInfo
class : org.apache.maven.plugin.war.util.WebappStructure
required-type : org.apache.maven.plugin.war.util.WebappStructure
path : /webapp-structure/dependenciesInfo

在网上查了一些资料,主要参考: http://jira.codehaus.org/browse/MWAR-187
之所以命令行能成功,而插件不成功,主要原因是二者的maven版本不一样造成的,因为2eclipse使用embedded Maven 3 (Maven Embedder 3.0.-SNAPSHOT),可以通过window->perferences->Maven->Installations查看到。

解决这个问题的方法在上文链接中也有提到:
1、Maven版本降级
2、最快捷的方式是禁用缓存(webapp-cache.xml)

<configuration>
<useCache>false</useCache>
</configuration>

3、在eclipse中用m2eclipse插,先运行mvn clean后(这样会删除target目录),再运行mvn install

References: http://jira.codehaus.org/browse/MWAR-187

Sunday, August 08, 2010

install sun java on ubuntu 10.04

Sun Java moved to the Partner repository

For Ubuntu 10.04 LTS, the sun-java6 packages have been dropped from the Multiverse section of the Ubuntu archive. It is recommended that you use openjdk-6 instead.

If you can not switch from the proprietary Sun JDK/JRE to OpenJDK, you can install sun-java6 packages from the Canonical Partner Repository. You can configure your system to use this repository via command-line:

$> add-apt-repository "deb http://archive.canonical.com/ lucid partner"
---------------
and then:
$> sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$> sudo apt-get update
$> sudo apt-get install sun-java6-jdk