maven入门

1、关于Idea中右边的maven projects窗口找不到了如何调出来

 

关于Idea中右边的maven  projects窗口找不到了如何调出来?

具体的idea版本我不太清楚,我用的是2016版,其他版本应该也是一样的。

首先idea自带了maven控件,不像Eclipse还需要下载控件,如果你以前有maven在右边,出于某种原因,消失找不到 了,你可以试试我写的方法。



方法1.你点击一下你idea界面最左下角的那个小框,maven应该从里面找到

方法2.点击菜单栏View->Tool  Windows->Maven projects 

方法3.点击菜单栏Help->Find Action(Ctrl+Shift+A),输入Maven projects

 

2、错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project course: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.: NullPointerException -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

点击错误链接得到

This error is reported in case the execution of a plugin failed due to some unforeseen event. For example, uncatched runtime exceptions caused by the plugin will raise this error. You should report this problem to the maintainer of the plugin.

如果插件的执行由于某些不可预见的事件而失败,则会报告此错误。 例如,由插件引起的未捕获的运行时异常将引发此错误。 你应该将这个问题报告给插件的维护者。

 

总结
1. 理论上来讲不做mvn clean 得到的jar包应该是最新的,除非其他方式修改jar包中的内容而不修改源代码。
2. 平时可以用mvn install,而不进行chean节省时间(如果你觉得节省时间多的话),但最保险还是用 mvn clean install 生成最新的jar包或其他包
3. 不想用mvn clean又想保证jar包最新,建议添加 -Djar.forceCreation 参数

jar-plugin源代码地址:http://svn.apache.org/repos/asf/maven/plugins/tags/maven-jar-plugin-2.4

解决方法2:使用插件,在相应pom.xml文件里面,修改

<configuration>

<testFailureIgnore>true</testFailureIgnore>

</configuration>

 

失败

增加@ignore失败

Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test failed.: NullPointerException -> [Help 1]

解决办法:

 在pom.xml文件里面修改:

<build> 
               <plugins>                              
                  <plugin>      
                               <groupId>org.apache.maven.plugins</groupId>                 
                               <artifactId>maven-surefire-plugin</artifactId>                    
                               <version>2.6</version>                          
                               <configuration>                                     
                               <skipTests>true</skipTests>                
                               </configuration>      
                   </plugin>  
                </plugins> 
</build>

 


posted @ 2018-05-05 01:52  floatthy  阅读(454)  评论(0编辑  收藏  举报