Nexus私人仓库和Maven网络上的一些错误的解决办法,进行修正

前几天在弄hudson持续集成,困难问题多多。实在搞不下去。先把Nexus和Maven遇到的问题记录下来。

学习参考了文档一下资料:

http://www.myexception.cn/windows/1069386.html

http://www.l99.com/EditText_view.action?textId=458901

主要是以上两篇资料

配置过程中遇到问题如下。

1:关于远程部署tomcat的war包

 <!-- tomcat 远程部署 -->
       <plugin>
		<groupId>org.codehaus.mojo</groupId>
		<artifactId>tomcat-maven-plugin</artifactId> 
        <version>1.1</version> 
		<configuration>
			 <update>true</update>
			 <username>admin</username> 
			 <password>admin</password> 
			 <server>tomcat</server>
			 <url>http://localhost:8090/manager/text</url>
			 <path>/${project.artifactId}</path>
		</configuration>
	   </plugin>

有很多文章说的version   是1.2-NSAPSHOT,但是,经过我的测试是不行的会报错。还有资料说必须是选择1.2版本,选择1.1会报错。很多资料误导人。

path为推送到远程tomcat的位置,这里直接是项目名。


2:关于程序包XXXXX找不到的问题。

这个问题存在的原因是因为在在pom.xml没有找到可以依赖的jar包。当我们把jar包放在WEB-INF/lib目录下面,并且在程序中引用了jar包,就会出现如下问题。

解决这个问题可以添加如下配置:

<plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
          <encoding>UTF-8</encoding>
          <!-- 读取项目jar包进行打包 -->
          <compilerArguments>
                <extdirs>${basedir}/WebRoot/WEB-INF/lib</extdirs>
         </compilerArguments>
        </configuration>
      </plugin>

我所查找的资料是这样的<extdirs>src/main/webapp/WEB-INF/lib</extdirs>。很明显,这是不科学的。我不知道那些这么配置的人是怎么实现的。


3:一个普遍存在的问题。字符编码问题

简体中文版的windows字符编码应该是GBK,而我写项目习惯用UTF-8,用maven编译的时候会存在字符编码问题。可以在pom.xml添加如下配置

 <properties>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
	<maven.compiler.encoding>UTF-8</maven.compiler.encoding>  
</properties>
就可以解决问题。







你可能感兴趣的:(Nexus私人仓库和Maven网络上的一些错误的解决办法,进行修正)