Sonatype Nexus以war包形式部署时始终报错,最后由此文章发现线索得以解决(还得靠google啊)
这两天以在tomcat上部署war包的形式跑nexus,总是报错,在自己机器上安装JDK7都不行,但在别人的机器上就可以运行(我后来安装和他们一模一样的JDK,但也不行),他们有的是JDK1.6的跑nexus-2.4.war都没问题。我开始怀疑是不是我安装了两套JDK影响的,因为在两个仅安装一个JDK的(并且从未卸载过)同事机器上跑是没问题,而我和另一个同事安装过两个JDK的都报同样的错误,但是在还有一个同事机器上安装两套JDK却没问题。折腾蒙了,最后在google上搜索异常,找到了这篇英文文章,从他发现是nexus工作目录sonatype-work问题找到灵感。于是搜了一下如何修改war包中nexus的sonatype-work,在解压的war包中修改nexus-2.4\WEB-INF目录下的plexus.properties文件,将里面nexus-work对应的值改掉,放在tomcat中,启动,成功!
?
修改sonatype-work目录的方法如下:
最近搭建Maven本地私服,下载了内置Jetty的Nexus,发现按照网上介绍的方法尝试迁移Nexus的工作目录,发现有时有效,有时又无效,经过一下午的研究后,最终确定下面的解决方案。。
?
一、如果下载的是WAR包版,请修改:
%Nexus_HOME%/conf/nexus.properties
nexus-work=${bundleBasedir}/../../sonatype-work/nexus
?
二、如果下载的是内置Jetty版,请修改:
1、start-nexus方式启动
%Nexus_HOME%/conf/nexus.properties
nexus-work=${bundleBasedir}/../../sonatype-work/nexus
?
2、console-nexus方式启动
直接添加环境变量PLEXUS_NEXUS_WORK
?
建议:如果不建议有一个dos窗口的话,添加环境变量后,每次使用console-nexus的方式启动,好处是每次升级Nexus后不用修改配置文件。
?
?
?
Update, 26-02: Brian Demers from Sonatype pointed out in the comments that Maven 2.0.10 and later are forwards-compatible with changes in the metadata format. If your Maven 2 version is one of the recommended versions on the download page, you will not have this problem.
Two days, in fact. Yesterday evening, after my colleagues went home, I brought down our Nexus 1.8.0.1 instance to upgrade it to 1.9 without interrupting their work. The download page for Nexus 1.9 contains the following instruction:
Sonatype has changed how the lucene indexes are stored on disk, it is required that users reindex all repositories in their nexus server to start benefitting from the changes (and for search to work properly).
Inconspicuous enough. Furthermore, clicking through from the change overview to the full change log reveals:
[NEXUS-3849] – Add full support for the new maven 3 snapshot metadata
What it doesn’t reveal is that the rebuild metadata command in the repository administration screen, which would appear to be proper housekeeping at a time when you’re reindexing the repositories, now generates Maven 3 style metadata and inadvertently breaks compatibility with Maven 2 (update: older versions). This is where the fun begins.
?
The funHaving upgraded Nexus to 1.9 and having rebuilt metadata en reindexed repositories, my Jenkins builds started failing:
. After another Rebuild Metadata, I finally have my repository metadata in Maven 2 format.Did that fix my Maven builds? Nope, because the Maven 3-style metadata files were still in my local repository. This is the home stretch; removing them from the local repository with another quick find command got my Maven 2 builds working again.
Getting some satisfactionOctober 8, 2012 at 1:44 pm
just saved about 2 hours on googling / trying / fixing / failing – thanks man!