日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

maven3安装和使用笔记

發(fā)布時(shí)間:2023/12/4 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 maven3安装和使用笔记 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>

1、下載

http://maven.apache.org/download.cgi

2、解壓

3、配置環(huán)境變量

M2_HOME ?D:\program\apache-maven-3.3.3

Path : ?%M2_HOME%\bin

4、驗(yàn)證是否成功

打開命令行窗口,輸入mvn -version,顯示版本號(hào),則安裝成功

我這里遇到了錯(cuò)誤: Unsupported major.minor version 51.0

這個(gè)是jdk版本過低造成的,maven3 要求至少jdk7,。

修改JAVA_HOME指向jdk1.7或者1.8,這個(gè)時(shí)候再執(zhí)行mvn -v命令,還是一樣的錯(cuò)誤提示,重開命令行,重新執(zhí)行,問題解決。

5、maven的倉庫地址是在D:\Program\apache-maven-3.0.4\conf 下的settings.xml 里面配置的,
? ??屬性名是localRepository
? ? ?默認(rèn)地址是:D:\我的文檔\.m2\repository
? ? ?上面的路徑是我自己的電腦里的配置

? ? ?新安裝的3.3.9版,默認(rèn)地址是C:\Users\he\.m2

6、執(zhí)行run as-maven install時(shí)報(bào)錯(cuò)

-Dmaven.multiModuleProjectDirectory system propery is not set.?Check $M2_HOME environment variable and mvn script match.

檢查環(huán)境變量已經(jīng)配置了,在控制臺(tái)輸入mvn命令也有效。

解決辦法是修改MyEclipse的配置,

在Window->Preference->Java->Installed JREs->Edit

在Default VM arguments中設(shè)置

-Dmaven.multiModuleProjectDirectory=$M2_HOME

7、可以在maven網(wǎng)站上選擇jar包,并自動(dòng)生成pom.xml里的配置,復(fù)制即可

地址:http://search.maven.org/

8、在MyEclipse中創(chuàng)建maven項(xiàng)目之后報(bào)下面的錯(cuò)誤

Failure?to?transfer?org.codehaus.plexus:plexus-io:jar:1.0?from?http://repo1.maven.org/maven2?was?cached?in?the?local?repository,?resolution?will?not?be?reattempted?until?the?update?interval?of?central?has?elapsed?or?updates?are?forced.?Original?error:?Could?not?transfer?artifact?org.codehaus.plexus:plexus-io:jar:1.0?from/to?central?(http://repo1.maven.org/maven2):?No?response?received?after?60000

?

這個(gè)錯(cuò)誤是更新jar包失敗,解決辦法是去本地倉庫刪掉對應(yīng)的包,然后在項(xiàng)目上點(diǎn)擊右鍵->Maven4MyEclipse->Update Dependencies ,如果報(bào)其他的包更新失敗,也采取同樣的辦法

9、在命令行中想要操作指定的項(xiàng)目,需要首先進(jìn)入需要構(gòu)建的項(xiàng)目目錄,然后執(zhí)行mvn的相關(guān)命令。

10、將jar包部署到j(luò)boss的方法

首先配置jboss的plugin,在pom.xml中添加以下語句

???<plugin><groupId>org.codehaus.mojo</groupId><artifactId>jboss-maven-plugin</artifactId><version>1.5.0</version><configuration><jbossHome>E:\Program\jboss-eap-5.0\jboss-as</jbossHome><serverName>default</serverName></configuration></plugin>

?

然后在項(xiàng)目目錄下執(zhí)行命令

?mvn?clean?install?jboss:hard-undeploy?jboss:hard-deploy?jboss:start

?

11、No persistence.xml file found in project

解決辦法:psersistence.xml要放在META-INF下面

12、The method setApplicationContext(ApplicationContext) of type ApplicationContextUtils
?must override a superclass method
解決辦法:將jdk版本從1.5換成1.6

13、使用maven構(gòu)建項(xiàng)目時(shí)報(bào)錯(cuò):gbk的不可映射字符

解決辦法:在編譯插件上添加配置項(xiàng)<encoding>utf8</encoding>,詳細(xì)代碼如下

???<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.3.1</version><configuration><source>1.6</source><target>1.6</target><encoding>utf8</encoding></configuration></plugin>

?

14、Can not find the tag library descriptor for “http://java.sun.com/jsp/jstl/core”

明明已經(jīng)引入了jstl包,但是還是報(bào)這個(gè)錯(cuò)誤

解決辦法:把jstl的依賴刪除重新加入就好了

15、VERSION OF SPRING FACET COULD NOT BE DETECTED.
The migration process needs to detect the correct version of Spring support used by a project. If the process fails to detect the version based on containers used by the project, it tries to read it from the .springBeans file. If the file is missing, the migration process is unable to continue.

You need to manually create the file in the root of the project, before invoking the Migration wizard. To do so, right-click the project, and select New>File from the menu. Enter .springBeans as the file name, and click Finish. The .springBeans file editor should open. Paste the following code into it, and save the file.

<?xml version="1.0" encoding="UTF-8"?>
<beansProjectDescription>
? <springVersion>2.0</springVersion>
</beansProjectDescription>

Now you can rerun the migration process by selecting MyEclipse>Migrate Projects from theMyEclipsemenu, or run the process from the Project Migration view.

Note: The .springBeans file might not appear in the Package Explorer view; you will need to disable the.* resources filter to see it. To do so, click the white triangle (View menu) in the top-right corner of the Package Explorer view and select Filters. Next, deselect the .* resources filter, and click OK. You should now be able to see the .springBeans file.

16、webrootkey已經(jīng)注冊

解決辦法,在web.xml文件里添加參數(shù)

<context-param><param-name>webAppRootKey</param-name><param-value>cmes_web.root</param-value> </context-param>

?

?17、pom.xml中使用環(huán)境變量

????<plugin><groupId>org.codehaus.mojo</groupId><artifactId>jboss-maven-plugin</artifactId><version>1.5.0</version><configuration><jbossHome>${env.JBOSS_HOME}</jbossHome><serverName>default</serverName></configuration></plugin>

轉(zhuǎn)載于:https://my.oschina.net/u/173975/blog/530443

總結(jié)

以上是生活随笔為你收集整理的maven3安装和使用笔记的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。