Nexus私人仓库和Maven网络上的一些错误的解决办法,进行修正
2014-04-04 23:31
453 查看
前几天在弄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>就可以解决问题。
学习参考了文档一下资料:
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>就可以解决问题。
相关文章推荐
- eclipse使用maven时共享Nexus仓库index缓存的解决办法
- docker registry私有仓库的一些错误解决办法
- maven 工程一些错误的解决办法
- mysql Access denied for user \'root\'@\'localhost\'”解决办法总结,下面我们对常见的出现的一些错误代码进行分析并给出解决办法,有需要的朋友可参考一下。
- 错误代码 0x80070035 找不到网络路径 终极解决办法
- Maven项目下报错误java.lang.ClassNotFoundException的解决办法
- maven 错误解决办法集
- maven 错误解决办法集
- 编译php时的一些典型错误及解决办法.
- Android开发八 “尚未注册网络”错误信息的解决办法
- Could not locate executable null 解决办法【在windows环境下开发hadoop2.4.1或者hadoop2.5.2的mapreduce,执行job遇到的一些错误】
- CentOS下编译php时的一些典型错误及解决办法
- 关于java socket 一些常见错误的解决办法
- 3、“尚未注册网络”错误信息的解决办法
- Ubuntu下运行Eclipse时一些错误的解决办法:
- maven项目中 “ 错误: 找不到或无法加载主类" 的解决办法
- 网狐荣耀版手机端登录提示“网络错误:5”解决办法
- 总结的ibatis和spring整合时候出现的一些错误解决办法,更新中……
- 内核编译错误的一些解决办法
- 初学Android时遇到的一些错误及解决办法——之一