gpt4 book ai didi

详解Maven环境的搭建与idea配置

转载 作者:qq735679552 更新时间:2022-09-27 22:32:09 24 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章详解Maven环境的搭建与idea配置由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

本文主要介绍了maven环境的搭建与idea配置,分享给大家,具体如下:

Maven 下载: http://maven.apache.org/download.cgi 。

Maven 中央仓库地址:http://search.maven.org 。

配置maven环境变量 。

m2_home:d:\workspace\maven\apache-maven-3.0.5 。

path:;%m2_home%/bin,

检查是否成功,打开cmd:

mvn -v 。

mvn install 会将项目生成的构件安装到本地maven仓库 。

mvn deploy 用来将项目生成的构件分发到远程maven仓库 。

d:\>mvn archetype:generate:在d:盘构建maven标准项目目录结构 。

2、settings.xml文件配置 。

2.0修改本地仓库位置 。

m2_home目录下 conf/settings.xml 。

?
1
<localrepository>d:/workspace/maven/stone</localrepository>

2.1如何配置远程仓库(私服): (nexus-2.0.4-1-bundle) 。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<profiles>
   <profile>
     <id>nexus</id>
     <repositories><!--配置远程仓库-->
       <repository>
         <id>nexus</id>
         <name>central repository</name>
         <url>http: //127.0.0.1/nexus/content/groups/public</url>
         <releases>
           <enabled> true </enabled>
         </releases>
         <snapshots>
           <enabled> false </enabled><!---->
         </snapshots>
       </repository>
     </repositories>
     <pluginrepositories><!--配置maven从什么地方下载插件构件-->
       <pluginrepository>
         <id>nexus</id>
         <name>central repository</name>
         <url>http: //127.0.0.1/nexus/content/groups/public</url>
         <releases>
           <enabled> true </enabled>
         </releases>
         <snapshots>
           <enabled> false </enabled>
         </snapshots>
       </pluginrepository>
     </pluginrepositories>
   </profile>
</profiles>
 
<activeprofiles><!--激活 远程仓库-->
     <activeprofile>nexus</activeprofile>
</activeprofiles>

2.2还可以配置仓库的镜像下载 。

?
1
2
3
4
5
6
7
<mirrors>
<mirror><!--配置镜像-->
   <id>nexus</id>
   <mirrorof>*</mirrorof>
   <url>http: //127.0.0.1/nexus/content/groups/public</url>
</mirror>
</mirrors>

3、pom.xml文件配置依赖 。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<project xmlns= "http://maven.apache.org/pom/4.0.0" xmlns:xsi= "http://www.w3.org/2001/xmlschema-instance"
      xsi:schemalocation= "http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
   <modelversion> 4.0 . 0 </modelversion>
   <groupid>xu.feifei</groupid>
   <artifactid>feifei</artifactid>
   <packaging>war</packaging>
   <version> 1.0 </version>
 
   <dependencies>
 
     <dependency>
       <groupid>junit</groupid>
       <artifactid>junit</artifactid>
       <version> 3.8 . 1 </version>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupid>org.json</groupid>
       <artifactid>json</artifactid>
       <version> 20090211 </version>
     </dependency>
 
   </dependencies>
 
   <build>
     <finalname>feifei</finalname>
   </build>
   
</project>

2、idea的搭建maven相关配置 。

. 。

详解Maven环境的搭建与idea配置

maven项目的包结构 。

详解Maven环境的搭建与idea配置

设置maven自动导包 。

详解Maven环境的搭建与idea配置

详解Maven环境的搭建与idea配置

详解Maven环境的搭建与idea配置

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我.

原文链接:http://blog.csdn.net/xxb2008/article/details/8772634 。

最后此篇关于详解Maven环境的搭建与idea配置的文章就讲到这里了,如果你想了解更多关于详解Maven环境的搭建与idea配置的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com