SpringToolSuite4中集成maven

2023-11-06

目录

一、什么是Maven?

 二、Maven的使用


一、什么是Maven?

        Maven是基于项目对象模型(POM project object model),可以通过一小段描述信息(配置)来管理项目的构建,报告和文档的软件项目管理工具。 Maven的核心功能便是合理叙述项目间的依赖关系。通俗点讲,就是通过pom.xml文件的配置获取jar包,而不用手动去添加jar包。

Pom.xml

 二、Maven的使用

1. 解压maven即可。

2. 修改maven安装路径下的conf文件夹中的setting.xml。一处是本地仓储,一处是修改下载镜像,还有是修改默认使用的JDK为1.8。

<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in
 |                 ${maven.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
	<!--本地仓库的地址:存放jar包-->
	<localRepository>D:/Java/m2/repository</localRepository>
  <!-- interactiveMode
   | This will determine whether maven prompts you when it needs input. If set to false,
   | maven will use a sensible default value, perhaps based on some other setting, for
   | the parameter in question.
   |
   | Default: true
  <interactiveMode>true</interactiveMode>
  -->

  <!-- offline
   | Determines whether maven should attempt to connect to the network when executing a build.
   | This will have an effect on artifact downloads, artifact deployment, and others.
   |
   | Default: false
  <offline>false</offline>
  -->

  <!-- pluginGroups
   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
   |-->
  <pluginGroups>
    <!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
    -->
  </pluginGroups>

  <!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
  </proxies>

  <!-- servers
   | This is a list of authentication profiles, keyed by the server-id used within the system.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   |-->
  <servers>
    <!-- server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the 'id' attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     |
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
    -->

    <!-- Another sample, using keys to authenticate.
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->
  </servers>

  <!-- mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   |
   | It works like this: a POM may declare a repository to use in resolving certain artifacts.
   | However, this repository may have problems with heavy traffic at times, so people have mirrored
   | it to several places.
   |
   | That repository definition will have a unique id, so we can create a mirror reference for that
   | repository, to be used as an alternate download site. The mirror site will be the preferred
   | server for that repository.
   |-->
  <mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
	 <!--更换阿里镜像,加快依赖下载-->
	<mirror>
		<id>nexus-a1iyun</id>
		<mirrorOf>central</mirrorOf>
		<name>Nexus aliyun</name>
		<url>http://maven.aliyun.com/nexus/content/groups/public</url>
	</mirror>
  </mirrors>

  <!-- profiles
   | This is a list of profiles which can be activated in a variety of ways, and which can modify
   | the build process. Profiles provided in the settings.xml are intended to provide local machine-
   | specific paths and repository locations which allow the build to work in the local environment.
   |
   | For example, if you have an integration testing plugin - like cactus - that needs to know where
   | your Tomcat instance is installed, you can provide a variable here such that the variable is
   | dereferenced during the build process to configure the cactus plugin.
   |
   | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
   | section of this document (settings.xml) - will be discussed later. Another way essentially
   | relies on the detection of a system property, either matching a particular value for the property,
   | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
   | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
   | Finally, the list of active profiles can be specified directly from the command line.
   |
   | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
   |       repositories, plugin repositories, and free-form properties to be used as configuration
   |       variables for plugins in the POM.
   |
   |-->
  <profiles>
    <!-- profile
     | Specifies a set of introductions to the build process, to be activated using one or more of the
     | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
     | or the command line, profiles have to have an ID that is unique.
     |
     | An encouraged best practice for profile identification is to use a consistent naming convention
     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
     | This will make it more intuitive to understand what the set of introduced profiles is attempting
     | to accomplish, particularly when you only have a list of profile id's for debug.
     |
     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
    <profile>
      <id>jdk-1.4</id>

      <activation>
        <jdk>1.4</jdk>
      </activation>

      <repositories>
        <repository>
          <id>jdk14</id>
          <name>Repository for JDK 1.4 builds</name>
          <url>http://www.myhost.com/maven/jdk14</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
    -->
	<profile>
      <id>jdk-1.8</id>

      <activation>
        <jdk>1.8</jdk>
      </activation>

      <repositories>
        <repository>
          <id>jdk18</id>
          <name>Repository for JDK 1.8 builds</name>
          <url>http://www.myhost.com/maven/jdk18</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
    <!--
     | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
     | might hypothetically look like:
     |
     | ...
     | <plugin>
     |   <groupId>org.myco.myplugins</groupId>
     |   <artifactId>myplugin</artifactId>
     |
     |   <configuration>
     |     <tomcatLocation>${tomcatPath}</tomcatLocation>
     |   </configuration>
     | </plugin>
     | ...
     |
     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
     |       anything, you could just leave off the <value/> inside the activation-property.
     |
    <profile>
      <id>env-dev</id>

      <activation>
        <property>
          <name>target-env</name>
          <value>dev</value>
        </property>
      </activation>

      <properties>
        <tomcatPath>/path/to/tomcat/instance</tomcatPath>
      </properties>
    </profile>
    -->
  </profiles>

  <!-- activeProfiles
   | List of profiles that are active for all builds.
   |
  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
    <activeProfile>anotherAlwaysActiveProfile</activeProfile>
  </activeProfiles>
  -->
</settings>

 

 可参照eclipse集成maven eclipse配置Maven环境_烟火的博客-CSDN博客_eclipse搭建maven环境

3. SpringToolSuite4集成Maven。

 

 

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

SpringToolSuite4中集成maven 的相关文章

  • Java 中等效的并行扩展

    我在 Net 开发中使用并行扩展有一些经验 但我正在考虑在 Java 中做一些工作 这些工作将受益于易于使用的并行库 JVM 是否提供任何与并行扩展类似的工具 您应该熟悉java util concurrent http java sun
  • 如何默认将 Maven 插件附加到阶段?

    我有一个 Maven 插件应该在编译阶段运行 所以在项目中consumes我的插件 我必须做这样的事情
  • Play框架运行应用程序问题

    每当我尝试运行使用以下命令创建的新 Web 应用程序时 我都会收到以下错误Play http www playframework org Error occurred during initialization of VM Could no
  • Java JDBC:更改表

    我希望对此表进行以下修改 添加 状态列 varchar 20 日期列 时间戳 我不确定该怎么做 String createTable Create table aircraft aircraftNumber int airLineCompa
  • 在 HTTPResponse Android 中跟踪重定向

    我需要遵循 HTTPost 给我的重定向 当我发出 HTTP post 并尝试读取响应时 我得到重定向页面 html 我怎样才能解决这个问题 代码 public void parseDoc final HttpParams params n
  • JAXb、Hibernate 和 beans

    目前我正在开发一个使用 Spring Web 服务 hibernate 和 JAXb 的项目 1 我已经使用IDE hibernate代码生成 生成了hibernate bean 2 另外 我已经使用maven编译器生成了jaxb bean
  • 加速代码 - 3D 数组

    我正在尝试提高我编写的一些代码的速度 我想知道从 3d 整数数组访问数据的效率如何 我有一个数组 int cube new int 10 10 10 我用价值观填充其中 然后我访问这些值数千次 我想知道 由于理论上所有 3d 数组都存储在内
  • Liferay ClassNotFoundException:DLFileEntryImpl

    在我的 6 1 0 Portal 实例上 带有使用 ServiceBuilder 和 DL Api 的 6 1 0 SDK Portlet 这一行 DynamicQuery query DynamicQueryFactoryUtil for
  • 操作错误不会显示在 JSP 上

    我尝试在 Action 类中添加操作错误并将其打印在 JSP 页面上 当发生异常时 它将进入 catch 块并在控制台中打印 插入异常时出错 请联系管理员 在 catch 块中 我添加了它addActionError 我尝试在jsp页面中打
  • Spring Data JPA 应用排序、分页以及 where 子句

    我目前正在使用 Spring JPA 并利用此处所述的排序和分页 如何通过Spring data JPA通过排序和可分页查询数据 https stackoverflow com questions 10527124 how to query
  • Spring @RequestMapping 带有可选参数

    我的控制器在请求映射中存在可选参数的问题 请查看下面的控制器 GetMapping produces MediaType APPLICATION JSON VALUE public ResponseEntity
  • 为什么HashMap不能保证map的顺序随着时间的推移保持不变

    我在这里阅读有关 Hashmap 和 Hashtable 之间的区别 http javarevisited blogspot sg 2010 10 difference Between hashmap and html http javar
  • 加密 JBoss 配置中的敏感信息

    JBoss 中的标准数据源配置要求数据库用户的用户名和密码位于 xxx ds xml 文件中 如果我将数据源定义为 c3p0 mbean 我会遇到同样的问题 是否有标准方法来加密用户和密码 保存密钥的好地方是什么 这当然也与 tomcat
  • Java Integer CompareTo() - 为什么使用比较与减法?

    我发现java lang Integer实施compareTo方法如下 public int compareTo Integer anotherInteger int thisVal this value int anotherVal an
  • 如何在控制器、服务和存储库模式中使用 DTO

    我正在遵循控制器 服务和存储库模式 我只是想知道 DTO 在哪里出现 控制器应该只接收 DTO 吗 我的理解是您不希望外界了解底层域模型 从领域模型到 DTO 的转换应该发生在控制器层还是服务层 在今天使用 Spring MVC 和交互式
  • 编译器抱怨“缺少返回语句”,即使不可能达到缺少返回语句的条件

    在下面的方法中 编译器抱怨缺少退货声明即使该方法只有一条路径 并且它包含一个return陈述 抑制错误需要另一个return陈述 public int foo if true return 5 鉴于Java编译器可以识别无限循环 https
  • Firebase 添加新节点

    如何将这些节点放入用户节点中 并创建另一个节点来存储帖子 我的数据库参考 databaseReference child user getUid setValue userInformations 您需要使用以下代码 databaseRef
  • 使用 JMF 创建 RTP 流时出现问题

    我正处于一个项目的早期阶段 需要使用 RTP 广播DataStream创建自MediaLocation 我正在遵循一些示例代码 该代码目前在rptManager initalize localAddress 出现错误 无法打开本地数据端口
  • java.lang.IllegalStateException:驱动程序可执行文件的路径必须由 webdriver.chrome.driver 系统属性设置 - Similiar 不回答

    尝试学习 Selenium 我打开了类似的问题 但似乎没有任何帮助 我的代码 package seleniumPractice import org openqa selenium WebDriver import org openqa s
  • 将 List 转换为 JSON

    Hi guys 有人可以帮助我 如何将我的 HQL 查询结果转换为带有对象列表的 JSON 并通过休息服务获取它 这是我的服务方法 它返回查询结果列表 Override public List

随机推荐

  • UE4 C++ 使用第三方库(动态库) 详解

    目录 1 代码共享的方式 2 使用三方库 2 1 准备一个动态库 包含 h lib dll 2 2 创建一个UE C 工程 2 3 配置三方库 1 代码共享的方式 在使用三方库之前 先介绍一下三方库的由来 以及为什么需要三方库 就从程序员共
  • flex布局下Table组件宽度自适应

    方案一 在父级及 祖先 元素添加 overflow hidden ps 如果Table的上一级元素是flex布局 就设置上一级元素overflow属性 如果上一级元素的上一级元素也是flex布局 继续设置overflow属性 直到出现不再是
  • laradock卡在raw.githubusercontent.com,怎么办

    安装laradock的时候 一直卡在 curl 35 OpenSSL SSL connect Connection reset by peer in connection to raw githubusercontent com 443 b
  • STCH8高级PWM定时器输入捕获功能脉宽测量

    STC8H高级PWM定时器输入捕获功能脉宽测量 相关篇 STC单片机利用PCA功能测量脉宽以及通用定时器 外部中断测量脉宽 此功能和stc8G系列和stc15系列的PCA功能类似 带有此功能的有如下型号 STC8H 系列的单片机内部集成了8
  • 面试-Redis篇-Redis有序集合实现多字段排序

    排行榜需求 根据分数进行排序 分数相同时根据时间并列排序 根据分数排序很容易实现 正序 redis Yii app gt redis gt zrange key start end true 倒序 redis Yii app gt redi
  • 基础算法题——错误票据(输入输出)

    前言 以前对getline并没有太深地理解 甚至觉得cin就够用 直至遇到了这道算法题 错误票据题目 问题描述 某涉密单位下发了某种票据 并要在年终全部收回 每张票据有唯一的ID号 全年所有票据的ID号是连续的 但ID的开始数码是随机选定的
  • rockchip — display-timing dts配置

    rockchip display timing dts配置 如何确定lcd timing参数
  • JDBC、C3P0、DBUtils

    一 JDBC的内容 JDBC API 定义了一系列的接口和类 集成在java sql和javax sql DriverManager 管理各种不同的JDBC驱动 JDBC驱动 负责连接不同类型的数据库 二 JDBC访问数据库步骤 Drive
  • 随机变量之常见分布

    0 概述 统计分析是可以帮助人们认清 刻画不确定性的方法 总体是某一特定事物可能发生结果的集合 随机变量 Random Variable 则是一个不确定事件结果是数值函数 Function 也就是说 把不确定事件的结果用数值来表述 即得到随
  • 开源盛会来袭,开发者们不容错过!

    开源社 KAIYUANSHE 当今国内开源势头正劲 想利用好开源软件 在开源的大潮中乘风破浪 成为佼佼者吗 2022 第七届中国开源年会 COSCon 22 将于 10 月 29 日 30 日 在线上 元宇宙 传统线上直播渠道 与线下 10
  • celery 启用worker ValueError: not enough values to unpack

    2018 01 12 19 08 15 545 INFO MainProcess Received task tasks add 5d387722 5389 441b 9b01 a619b93b4702 2018 01 12 19 08 1
  • oracle数据泵导入导出6,Oracle使用数据泵导入/导出数据(expdp/impdp)

    A电脑上的操作 expdp数据导出 运行cmd 登录数据库 输入命令 sqlplus 使用管理员角色登录需要在用户名后加 as sysdba 例如 sys as sysdba 创建目录路径 输入命令 create directory dat
  • Docker基础与基于Docker的ROS系统使用说明

    docker常用命令 docker load i xxx tar 将tar包导入为本地镜像 docker ps 列出所有正在运行的容器 docker image ls 列出所有的镜像 docker start
  • 浅谈 IEEE 802.3af 标准 PSE电路

    从第一篇文章 我们已经大致了解整个POE的组成 这篇文章我们主要学习 IEEE 802 3af 标准的 受电端电路 主要简化电路如下 电路中省略了芯片等 只为一个大概的电路图 从电路可以看出主要分为三个部分 具体过程如下 在分级阶段 PSE
  • spring cloud 升级config-client及部署问题

    接昨天 升级微服务到config client又遇到一些问题 花了大半天的时间 其实 不该花这么久的 所以还是踩坑了 直接说问题吧 rabbitmq连接报错 主要有几个报错 原因应该都是未连接上rabbitmq导致的 org springf
  • Ubuntu下QtOpenGL无法正常使用GLU库的解决方法

    本文来自 http www linuxdiyf com linux 2873 html 一 修改makefile文件 某个库的接口不被识别的最可能的原因是没有包含该库的头文件 可以尝试将 include
  • idea添加database插件_IDEA插件系列(6):Database Navigator插件操作数据库

    0 目录 1 插件介绍 2 安装方式 3 使用方法 1 插件介绍 Database Navigator插件 该产品为IntelliJ IDEA开发环境和相关产品增加了广泛的数据库开发和维护功能 它与合格且符合IDE要求的SQL和PL SQL
  • Web自动化测试12:Selenium窗口截图、验证码处理

    更多功能测试以及全套学习路线图均在专栏 戳进去领取 Web自动化测试01 认识web自动化在什么项目中适用 Web自动化测试02 Web自动化测试工具选择大全 Web自动化测试03 Selenium安装配置 详细教程 Web自动化测试04
  • kubernetes Deployment 详解 更新/回滚/缩放/暂停/恢复部署操作

    涉及文档 Deployments 官方文档 Deployments 简介 一个 Deployment 为 Pods 和 ReplicaSets 提供声明式的更新能力 你负责描述 Deployment 中的 目标状态 而 Deployment
  • SpringToolSuite4中集成maven

    目录 一 什么是Maven 二 Maven的使用 一 什么是Maven Maven是基于项目对象模型 POM project object model 可以通过一小段描述信息 配置 来管理项目的构建 报告和文档的软件项目管理工具 Maven