maven使用感受

第一次接触的时候,什么都不懂,感觉好复杂。

后来系统地看了一个使用教程:

简单评价一下:

自动帮我们下载jar架包,还有就是可以执行命令自己部署到远程服务器上面去。

缺点:

学习成本。一般人不了解。第二,如果网络卡的话,就要命了,下载就要好多时间,还不如直接copy架包方便。

2018-10-12

mvn install的时候,包含源码,方便查看。

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <attach>true</attach>
                </configuration>
            </plugin>

 2018-10-20

一直提示maven-resources-plugin:2.6找不到,本来是有网的,又不去下载,每次maven install都失败,换了eclipse也是这样。

解决办法:https://blog.csdn.net/lilun517735159/article/details/78289699

maven setting.xml里加上

<mirror>
  <id>Central</id>
  <url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>
  <mirrorOf>central</mirrorOf>
</mirror>

 后来又不行了,在eclipse执行不了,用cmd使用mvn install又行,好奇怪。

后来还是找到原因了:

Eclipse -> Window -> Preferences -> 左边菜单找到Maven -> 找到User Settings

看到没,它的默认地址是C:UsersAdministrator.m2setting.xml,按“Browserr”定位到你自己的setting.xml,里面要有上面说到的镜像修改,这样设置后,就ok了。

2018-10-24

使用CXF生成代码出现:WSDLToJava Error: Rpc/encoded wsdls are not supported with CXF

解决办法:打开wsdl文件,把里面的style="rpc"改成style="document"

<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

 2018-10-31

今天好神奇,用maven,在eclipse里面Run As  ->  Maven install  控制台显示BUILD SUCCESS了。

但是另一个工程死活识别不了最新的代码,后来,我进入工程之后,运行cmd控制台,mvn install  然后就好了,另一个工程也能识别了。

 2020-04-17

JUnit Test能通过,但是Maven Test不能通过,

原来是因为JUnit Test能识别src/main/resource中的文件,但是Maven Test不能识别src/main/resource

解决办法,在pom.xml里加上

    <build>
        <resources>
            <resource>
                    <directory>${project.basedir}/src/main/resource</directory>
            </resource>
        </resources>
    </build>
原文地址:https://www.cnblogs.com/angelshelter/p/6411648.html