[size=small]
Maven插件列表
[url]https://maven.apache.org/plugins/index.html[/url]
[b]只是更新或解析项目的依赖, only update dependencies[/b]
mvn dependency:resolve
If you just want to re-load/update dependencies (I assume, with constantly changing you mean either SNAPSHOTS or local dependencies you update yourself), you can use mvn dependency:resolve
[b]命令行下指定User Level的settings.xml文件[/b]
mvn -s d:\path\settings.xml jetty:run
[b]查看maven使用的global and User settings.xml位置[/b]
[url]http://stackoverflow.com/questions/9988814/how-do-i-find-out-which-settings-xml-file-maven-is-using[/url]
[color=red]不过好像只有maven 3.0开始才有用,Maven version 2.2.1好像就不行[/color]
Start maven with -X option (debug) and examine the beginning of the output. There should be something like this:
...
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from c:\....\apache-maven-3.0.3\conf\settings.xml
[DEBUG] Reading user settings from c:\....\.m2\settings.xml
[DEBUG] Using local repository at C:\....\repository
...
[b]maven系统属性和环境变量属性[/b]
mvn help:system
命令可以显示所有系统属性和环境变量属性
[b]指定当前project的maven编译时用的java编译器版本和字符集编码[/b]
[url]http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html[/url]
[/size]
[size=small][b]为什么project的maven依赖不正确,指向过时的依赖?[/b]
原因很有可能是你根本没有mvn install过,或者说没有使用maven构建过项目,而只是创建了一个maven项目,修改了pom.xml里的依赖,然后update project,这样其实maven是不能保证指向正确的依赖包的,必须编译一次[/size]
Maven插件列表
[url]https://maven.apache.org/plugins/index.html[/url]
[b]只是更新或解析项目的依赖, only update dependencies[/b]
mvn dependency:resolve
If you just want to re-load/update dependencies (I assume, with constantly changing you mean either SNAPSHOTS or local dependencies you update yourself), you can use mvn dependency:resolve
[b]命令行下指定User Level的settings.xml文件[/b]
mvn -s d:\path\settings.xml jetty:run
[b]查看maven使用的global and User settings.xml位置[/b]
[url]http://stackoverflow.com/questions/9988814/how-do-i-find-out-which-settings-xml-file-maven-is-using[/url]
[color=red]不过好像只有maven 3.0开始才有用,Maven version 2.2.1好像就不行[/color]
Start maven with -X option (debug) and examine the beginning of the output. There should be something like this:
...
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from c:\....\apache-maven-3.0.3\conf\settings.xml
[DEBUG] Reading user settings from c:\....\.m2\settings.xml
[DEBUG] Using local repository at C:\....\repository
...
[b]maven系统属性和环境变量属性[/b]
mvn help:system
命令可以显示所有系统属性和环境变量属性
[b]指定当前project的maven编译时用的java编译器版本和字符集编码[/b]
[url]http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html[/url]
[/size]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
[size=small][b]为什么project的maven依赖不正确,指向过时的依赖?[/b]
原因很有可能是你根本没有mvn install过,或者说没有使用maven构建过项目,而只是创建了一个maven项目,修改了pom.xml里的依赖,然后update project,这样其实maven是不能保证指向正确的依赖包的,必须编译一次[/size]