springboot maven项目环境搭建idea

2023-11-03

springboot maven项目环境搭建idea

用到的软件

idea下载和安装

idea 2021.3,由于该软件比较大,大家可以自行网上下载。

可参考博文http://www.itmind.net/14911.html,感谢博主分享

java下载和安装

jdk1.8.0_221,由于该软件比较大,大家可以自行网上下载。

安装路径C:\Program Files\Java\jdk1.8.0_221

maven下载和安装

安装maven

apache-maven-3.6.0,下载地址https://download.csdn.net/download/a554521655/87740651 (仅2积分)

我的安装路径D:\ProgramFiles\apache-maven-3.6.0

添加JAVA_HOME路径,增加JRE环境
打开D:\ProgramFiles\apache-maven-3.6.0\bin\mvn.cmd文件,然后增加JAVA_HOME 
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_221

注意:
如果不增加的话,会报错:
idea:No compiler is provided in this environment. Perhaps you are running on a JRE
修改conf/settings.xml,请参考以下
<?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>D:\ProgramFiles\maven-repo</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>
            <id>aliyun</id>              
            <mirrorOf>central</mirrorOf>    
            <name>Nexus aliyun</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>  
        </mirror>
        <mirror>
            <id>maven.net.cn</id>
            <name>oneof the central mirrors in china</name>
            <url>http://maven.net.cn/content/groups/public/</url>
            <mirrorOf>central</mirrorOf>
        </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.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>
    -->
    <profile>     
      <id>JDK-1.8</id>       
      <activation>       
        <activeByDefault>true</activeByDefault>       
        <jdk>1.8</jdk>       
      </activation>       
      <properties>       
        <maven.compiler.source>1.8</maven.compiler.source>       
        <maven.compiler.target>1.8</maven.compiler.target>       
        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>       
      </properties>       
    </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>

项目idea配置

打开idea工具,在Settings里,进行maven、jdk和jre配置,如下图

image-20230428144843565

image-20230428144943827

image-20230428145015722

打开现有项目run或build

打开项目

启动idea,依次点击 File>>Open,在弹窗中,选择自己项目,点击ok即可

image-20230428153447928

项目正常打开后,会进行Sync,等待一段时间Sync finished。

此时,右上角会出现 run或build(首次打开项目可能不会出现),根据自己需求点击执行即可。亦可点击右侧Gradle,选择项目名/Tasks/application/run;

如果编译或运行出错,根据错误提示进行修正,增加缺少jar包或更修改代码。

image-20230504104750994
image-20230504104427444
image-20230428150842093

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

springboot maven项目环境搭建idea 的相关文章

随机推荐

  • 谷歌&北大扩散模型(Diffusion Model)首篇综述来了!

    本综述 Diffusion Models A Comprehensive Survey of Methods and Applications 来自加州大学 Google Research的Ming Hsuan Yang 北京大学崔斌实验室
  • 透析极大极小搜索算法和α-β剪枝算法(有案例和完整代码)

    文章目录 前言 minimax算法 完整代码 算法思想 代码实现 算法优化 剪枝算法 完整代码 算法思想 代码实现 算法对比 更多案例 结语 前言 先做了一版五子棋的小项目 后面又做了一个功能更强大的中国象棋的项目 但是始终都没有实现一版
  • Java+Aspose.diagram,导出数据到Visio

    背景 java 家谱图导出 主要包括家庭成员图片以及有关系进行连线 项目环境请参考 https download csdn net download weixin 49456013 20085264 或者是参考我关于Aspose相关的文章
  • 使用Eclipse与Pydev开发Python

    http loosky net 1152 html Python的编辑器很多 具体可见 http wiki python org moin PythonEditors 官方的IDLE PythonWin和Eclipse Pydev 是比较值
  • 服务器性能网络指标,什么是网络性能指标 网络性能指标有哪些

    什么是网络性能指标 网络性能指标有哪些 这些一定要考虑的 一 什么是网络性能指标 网络性能指标 是衡量网络性能的指标 包括带宽 时延 带宽时延积 二 网络性能指标有哪些 端到端的网络性能指标包括传输线路指标 网络时延指标和网络设备指标 1
  • 鲸鱼优化算法——使用Python实现

    鲸鱼优化算法 使用Python实现 鲸鱼优化算法是一种新兴的优化算法 它受到鲸鱼集群捕猎行为的启发 该算法具有全局搜索能力和收敛速度快等优点 在多个领域中得到了广泛应用 本文将介绍使用Python实现鲸鱼优化算法 并提供源代码 鲸鱼优化算法
  • ubuntu18.04源码编译pytorch

    上篇文章win10安装pytorch只是安装好了库 但是并不能追踪到pytorch源代码 windows平台下的源码编译太过麻烦 linux系统笔者是安装在虚拟机中 并不能调用宿主机的CUDA和CUDNN 但是还是编译一下CPU版的pyto
  • R语言绘制各式各样的图形

    R语言绘制五个节点的有向图 library igraph g2 lt graph edges c 1 4 1 3 1 2 1 5 2 4 2 3 2 5 n 5 gt set vertex attr color value cadetblu
  • 第17课:生活中的享元模式——颜料很贵必须充分利用

    用程序来模拟生活 从剧情中思考享元模式 享元模式 享元模式的模型抽象 类图 基于框架的实现 模型说明 设计要点 优缺点 应用场景 故事剧情 团队的拓展培训是很多大公司都组织的活动 因为素质拓展培训能将企业培训 团队建设 企业文化融入到有趣的
  • vue项目,浏览器报错:ReferenceError: h is not defined

    Jsx语法 遇到这种错误 检查一下自己data 内有没有类似图片上的代码结构的参数 这种属于jsx语法 也能直接将组件渲染出来 但是在某些特定情景下浏览器控制台会报 ReferenceError h is not defined这个错误 解
  • hystrix线程池隔离的原理与验证

    引子 幸福很简单 今天项目半年规划被通过 终于可以早点下班 先坐公交 全程开着灯 买了了几天的书竟然有时间看了 半小时后 公交到站 换乘大巴车 车还等着上人的功夫 有昏暗的灯光 可以继续看会儿书 过会儿车跑起来了 灯关了 我合上书 头靠着车
  • 压测工具Jmeter入门使用

    一 创建一个基础的Web测试 1 测试内容 模拟五个用户请求2次指定的http接口 并且重复2次 也就是总共请求有5 2 2 20 次 要构建本次内容需要用到Jmeter的元素 线程组 HTTP请求 HTTP请求默认值和图形结果 2 具体操
  • 单片机设计_智能计算器(AT89C51、LCD1602、矩阵键盘)

    基于单片机的智能计算器 AT89C51 LCD1602 矩阵键盘 想要更多项目私wo 一 简介 此电路由AT89C51最小系统 LCD1602液晶显示模块和矩阵键盘模块组成 二 执行效果 三 部分代码 S16 S12 S8 S4分别是123
  • 爬虫IP时效问题:优化爬虫IP使用效果实用技巧

    作为一名专业的爬虫程序员 我们经常遇到的一个棘手问题那就是爬虫IP的时效性 由于网站的反爬虫机制不断升级 很多爬虫IP的可用时间越来越短 导致我们的爬虫任务频繁中断 今天 我将和大家分享一些优化爬虫IP使用效果的实用技巧 希望能帮助大家解决
  • 【性能测试】性能测试之性能测试指标详解(性能指标、CPU、内存、负载、磁盘)

    目 录 一 系统性能测试指标 1 1 响应时间 1 2 并发 1 3 点击量 点击率 1 4 吞吐量 吞吐率 1 5 TPS QPS 1 6 PV UV 二 Linux服务器性能指标 2 1 CPU使用率 2 2 内存占用率 2 3 系统平
  • 使用R语言的`order()`函数对数据框(dataframe)的行进行排序

    使用R语言的order 函数对数据框 dataframe 的行进行排序 在R语言中 order 函数可以用来对数据框的行进行排序 排序可以按照一个或多个列的值来进行 可以选择是升序还是降序排列 下面我将详细介绍如何使用order 函数对数据
  • 天数怎么换算成月_怎么把日期转换为天数

    1 在EXCEL中如何把天数转为年月日 年月日转为天数 在EXCEL中把天数转为年月日具体步骤如下 1 第一步 电脑打开Excel表格 如下图所示 2 第二步 电脑打开Excel表格后 输入公式 INT I16 365 年 INT I16
  • Android studio 配置Git

    使用GIT前请阅读 有git基础可略过 git指引 http www bootcss com p git guide 一 下载git http git scm com download 二 安装 全部默认配置即可 三 配置 运行Git Ba
  • 佳能相机里误删的照片怎么恢复

    佳能相机一直以耐用性 高效性以及高画质著称 在相机领域里有一定口碑 相信很多人都是佳能的忠实粉丝 但是不管它的质量多么好 拍出来的照片多么高清 我们却总也避免不了人为的失误 万一不小心将里面的照片误删了 该怎么恢复呢 下面就一起来学习具体恢
  • springboot maven项目环境搭建idea

    springboot maven项目环境搭建idea 文章目录 springboot maven项目环境搭建idea 用到的软件 idea下载和安装 java下载和安装 maven下载和安装 安装maven 添加JAVA HOME路径 增加