---    用maven 的过程中 大问题小问题实在是不少 ,就不一篇文章一篇文章的写了,干脆写在一起 ----

-------  nexus 加索引

点击Administration菜单下面的Repositories,将这三个仓库Apache Snapshots,Codehaus Snapshots,Maven Central的configuration下的remote repository access 下的 Download Remote Indexes修改为true。然后在这三个仓库上分别右键,选择Re-index,这样Nexus就会去下载远程的索引文件。

(这里注意:reindex后,nexus只会把索引下载下来,而不是jar本身。只有当你运行项目时,才会真正根据索引下载相应的jar并放在 C:\Documents and Settings\localUser\sonatype-work\nexus\storage\ 下面。--当然同时,这些jar 也会下载到本地机器的.m2 工作仓库下。)

------- maven 生成eclipse 项目时报的错

Java代码  
  1. [INFO] Resource directory's path matches an existing source directory. Resources
  2. will be merged with the source directory src/main/resources
  3. [INFO] ------------------------------------------------------------------------
  4. [ERROR] BUILD ERROR
[INFO] Resource directory's path matches an existing source directory. Resources  will be merged with the source directory src/main/resources  [INFO] ------------------------------------------------------------------------  [ERROR] BUILD ERROR

可能会产生以上错误  在pom 文件中巴maven-eclipse-plugin 这样引入:

Java代码  
  1. <plugin>
  2. <groupId>org.apache.maven.plugins</groupId>
  3. <artifactId>maven-eclipse-plugin</artifactId>
  4. <version>2.6</version>
  5. <configuration>
  6. <wtpmanifest>true</wtpmanifest>
  7. <wtpapplicationxml>true</wtpapplicationxml>
  8. <wtpversion>2.0</wtpversion>
  9. </configuration>
  10. </plugin>
<plugin>      <groupId>org.apache.maven.plugins</groupId>      <artifactId>maven-eclipse-plugin</artifactId>      <version>2.6</version>      <configuration>       <wtpmanifest>true</wtpmanifest>       <wtpapplicationxml>true</wtpapplicationxml>       <wtpversion>2.0</wtpversion>      </configuration>     </plugin>

搞定。  (之前的问题是由于plugin 的版本引起的 改成2.6 就行了。)

-------   maven 部署到weblogic 上时可能出现内存溢出

Java代码  
  1. [INFO] Java heap space
  2. [INFO] ------------------------------------------------------------------------
  3. [INFO] Trace
  4. java.lang.OutOfMemoryError: Java heap space
[INFO] Java heap space  [INFO] ------------------------------------------------------------------------  [INFO] Trace  java.lang.OutOfMemoryError: Java heap space  

解决方案:在环境变量设置 MAVEN_OPTS=-Xms128m -Xmx512m     ---- 啊? 还有错么? 那就是机器内存不够啦 重启一下吧.....

----------   maven weblogic 插件的所有操作

http://maven-plugins.sourceforge.net/maven-weblogic-plugin/goals.html

----------    关于M2_REPO

这个问题还纠结了一阵子,记得以前配置的时候在eclipse中加M2_REPO变量后就能把仓库的jar加到eclipse中,但突然不好使了,后来不得不靠m2eclipse插件帮忙。 今天突然开窍.. 没在机器环境变量里配M2_REPO变量.....配置上后问题得以解决(卸载掉m2eclipse..)

----------    maven 解决嵌套依赖产生的冲突

比如说:jbpm 的依赖里面又做了对hibernate 的依赖 其pom里面引入了hibernate-core 等hibernate 的包,而项目又不能因为用jbpm对hibernate 的引入而删除本身项目对hibernate 的引入,因此为了避免重复引入造成的冲突,只能把jbpm对hibernate 的引入删去,这里只需要对pom 进行一个exclusion 就行了! 首先打开相应目录下的jbpm 的pom 看看其对hibernate 引入的groupId 和 artifactId 然后再在相应的jar 上面移除这两个依赖 写法如下:

Java代码  
  1. <dependency>
  2. <groupId>org.jbpm.jbpm4</groupId>
  3. <artifactId>jbpm-pvm</artifactId>
  4. <version>4.3</version>
  5. <exclusions>
  6. <exclusion>
  7. <groupId>org.hibernate</groupId>
  8. <artifactId>hibernate-core</artifactId>
  9. </exclusion>
  10. <exclusion>
  11. <groupId>javassist</groupId>
  12. <artifactId>javassist</artifactId>
  13. </exclusion>
  14. </exclusions>
  15. </dependency>
<dependency>     <groupId>org.jbpm.jbpm4</groupId>     <artifactId>jbpm-pvm</artifactId>     <version>4.3</version>     <exclusions>      <exclusion>       <groupId>org.hibernate</groupId>       <artifactId>hibernate-core</artifactId>      </exclusion>      <exclusion>       <groupId>javassist</groupId>       <artifactId>javassist</artifactId>      </exclusion>     </exclusions>    </dependency>

这样  移除了jbpm 下对hibernate 和javassist 的依赖  为了避免冲突。

----------    修改nexus工作目录

参照:http://marshal.easymorse.com/archives/1195

----------    用maven打包 maven war   (mvn war:war) 插件。

Java代码  
  1. <plugin>
  2. <groupId>org.apache.maven.plugins</groupId>
  3. <artifactId>maven-war-plugin</artifactId>
  4. <version>2.1-alpha-1</version>
  5. <configuration>
  6. <!--
  7. 打包之前过滤掉不想要被打进 .war包的jar,注意:这个地方,本来路径应该是
  8. WEB-INF/lib/anaalyzer-2.0.4.jar,但是经过多次试验,不能这样,至于咋回事儿,搞不清楚。。经多方查证均无结果
  9. 暂且这样吧,虽然显得很丑陋,但是总能解决问题吧
  10. -->
  11. <warSourceExcludes>*/lib/analyzer-2.0.4.jar</warSourceExcludes>
  12. <webResources>
  13. <resource>
  14. <!-- 元配置文件的目录,相对于pom.xml文件的路径 -->
  15. <directory>src/main/webapp/WEB-INF</directory>
  16. <!-- 是否过滤文件,也就是是否启动auto-config的功能 -->
  17. <filtering>true</filtering>
  18. <!-- 目标路径 -->
  19. <targetPath>WEB-INF</targetPath>
  20. </resource>
  21. </webResources>
  22. </configuration>
  23. </plugin>
<plugin>     <groupId>org.apache.maven.plugins</groupId>     <artifactId>maven-war-plugin</artifactId>     <version>2.1-alpha-1</version>     <configuration>      <!--       打包之前过滤掉不想要被打进 .war包的jar,注意:这个地方,本来路径应该是       WEB-INF/lib/anaalyzer-2.0.4.jar,但是经过多次试验,不能这样,至于咋回事儿,搞不清楚。。经多方查证均无结果       暂且这样吧,虽然显得很丑陋,但是总能解决问题吧      -->      <warSourceExcludes>*/lib/analyzer-2.0.4.jar</warSourceExcludes>      <webResources>       <resource>        <!-- 元配置文件的目录,相对于pom.xml文件的路径 -->        <directory>src/main/webapp/WEB-INF</directory>          <!-- 是否过滤文件,也就是是否启动auto-config的功能 -->        <filtering>true</filtering>          <!-- 目标路径 -->        <targetPath>WEB-INF</targetPath>       </resource>      </webResources>     </configuration>    </plugin>  

---其实执行mvn:package就可以了 不用在pom 中配这么多..  maven 会把打的war包放在项目目录的target目录下。 而且我使用mvn  war:war 时 打的包出问题了 不知道为啥.. 后来用mvn package 就没问题。不知道大家有没有遇到过...

最新文章

  1. ibatis map
  2. BFS、DFS与选课问题(拓扑排序)
  3. A20(Cubieboard2)启动过程浅析
  4. 一点一滴之NHibernate
  5. linux概念之进程分析
  6. spring的框架集,简化的编程模型
  7. RSS新闻阅读器
  8. python赋值和拷贝----一切皆对象,参数皆引用
  9. VS2010环境下使用VB开发网络编程(WinHttp)
  10. R语言从小木虫网页批量提取考研调剂信息
  11. RobotFramework自动化测试框架-移动手机自动化测试Clear Text关键字的使用
  12. Java集合系列[2]----LinkedList源码分析
  13. Web开发基础-Node.js-01
  14. HTML5之日历控件
  15. 基于Python实现的死链接自动化检测工具
  16. 一份C++学习资源,咬牙切齿地好用呀
  17. APIView源码解析
  18. 百度uid-generator源码
  19. LVS(Linus Virtual Server):三种负载均衡方式比较+另三种负载均衡方式
  20. 2018/03/23 每日一个Linux命令 之 sed

热门文章

  1. [翻译] Working with NSURLSession: AFNetworking 2.0
  2. spring Boot打可执行的jar包
  3. ngx_lua实现登录逻辑
  4. 字符串转换atof atoi atol gcvt strtod strtol strto ul toascii tolower toupper
  5. 深度学习材料:从感知机到深度网络A Deep Learning Tutorial: From Perceptrons to Deep Networks
  6. 第二章 企业项目开发--maven父子模块
  7. UVA 156 (13.08.04)
  8. Maximum Depth of Binary Tree leetcode java
  9. STL sort 函数实现详解 ZZ
  10. sublime uable to read project