springboot maven项目环境搭建idea

news2024/9/25 17:22:41

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1130973.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

uview 1 uni-app表单 number digit 的输入框有初始化赋值后,但是校验失败

背景&#xff1a; 在onReady初始化规则 onReady() { this.$refs.uForm.setRules(this.rules); }, 同时&#xff1a;ref,model,rules,props都要配置好。 报错 当input框限定type为number&#xff0c;digit类型有初始值不做修改动作,直接提交会报错&#xff0c;验…

仿美团外卖微信小程序源码/美团外卖优惠券领劵小程序-自带流量主模式

源码简介&#xff1a; 仿美团外卖微信小程序源码&#xff0c;它是美团外卖优惠券领劵小程序&#xff0c;还自带流量主模式。可以领取外卖优惠券的小程序。实用方便。 美团优惠券小程序带举牌小人带菜谱流量主模式&#xff0c;挺多外卖小程序的&#xff0c;但是都没有搭建教程…

Leetcode每日一题6.05:二叉树搜索树BST

二叉搜索树&#xff08;BST&#xff09; 根节点大于等于左子树所有节点&#xff0c;小于等于右子树所有节点。 二叉搜索树中序遍历即为节点从小到大排序。 230. 二叉搜索树中第K小的元素 题目描述&#xff1a; 给定一个二叉搜索树的根节点 root &#xff0c;和一个整数 k &a…

tcpdump 异常错误

tcpdump 进行抓包的时候&#xff0c;-w 提示 Permission denied&#xff1a; sudo tcpdump -w test1.log tcpdump: test1.log: Permission denied 开始以为是用户权限的问题&#xff0c;后来换用 root 账户还是不行&#xff0c;经搜索&#xff0c;是 AppArmor 的问题。 解决方…

一台服务器成了哆啦A梦的神奇口袋

如果我有一台服务器&#xff0c;那简直就像打开了哆啦A梦的神奇口袋&#xff01;可以做的事情可太多啦&#xff0c;比如&#xff1a; 学习和探险 首先嘛&#xff0c;当然是用来学习和探险啦&#xff01;我可以安装和配置各种操作系统、编程语言和工具&#xff0c;深入了解计…

优优嗨聚集团:美团外卖,让美好儿童餐计划触手可及

在当今这个快节奏的社会&#xff0c;父母们对于孩子的饮食健康越来越关注。如何让孩子吃得健康、吃得安心&#xff0c;是每一个家长都非常关心的问题。而美团外卖&#xff0c;作为中国最大的外卖平台之一&#xff0c;一直在积极推动美好儿童餐计划&#xff0c;让家长们能够更方…

docker(2)部署前后端分离springboot+vue项目

前置知识 虚拟网桥 docker容器需要在同一个网段才能通信&#xff0c;当启动一个容器时会自动连接一个docker中默认网桥段但此默认网桥段非本容器固定&#xff0c;当下次容器启动分配的ip会变&#xff0c;并且不可用名称直接访问。 自定义网段将需要互通的容器放入&#xff0c…

容联七陌入选沙利文2023中国AI技术变革典型企业

近日&#xff0c;全球增长咨询公司弗若斯特沙利文&#xff08;Frost & Sullivan&#xff0c;简称“沙利文”&#xff09;发布《2023年中国AI技术变革企业服务白皮书》&#xff0c;白皮书显示&#xff0c;容联七陌以大模型为支撑&#xff0c;通过生成式一体化智能客服全方位…

首枚开源社正式成员纪念徽章来啦

各位尊敬的开源社正式成员&#xff1a; 2023年10月16日&#xff0c;开源社刚过完第九个成立生日&#xff0c;开源社与您共同迎接第十年的到来&#xff01; 首枚开源社正式成员纪念徽章&#xff0c;满载作为开源人的归属感和荣誉感&#xff0c;设计上我们采用开源社 logo 的经典…

【Java集合类面试十八】、ConcurrentHashMap是怎么分段分组的?

文章底部有个人公众号&#xff1a;热爱技术的小郑。主要分享开发知识、学习资料、毕业设计指导等。有兴趣的可以关注一下。为何分享&#xff1f; 踩过的坑没必要让别人在再踩&#xff0c;自己复盘也能加深记忆。利己利人、所谓双赢。 面试官&#xff1a;ConcurrentHashMap是怎么…

使用BASE64实现编码和解码

系列文章目录 SpringBoot整合RabbitMQ并实现消息发送与接收 解析JSON格式参数 & 修改对象的key VUE整合Echarts实现简单的数据可视化 Java中运用BigDecimal对字符串的数值进行加减乘除等操作 List&#xff1c;HashMap&#xff1c;String,String&#xff1e;&#xff1e;实…

如何在Puppeteer中设置User-Agent来绕过京东的反爬虫机制?

概述 京东作为中国最大的电商平台&#xff0c;为了保护其网站数据的安全性&#xff0c;采取了一系列的反爬虫机制。然而&#xff0c;作为开发者&#xff0c;我们可能需要使用爬虫工具来获取京东的数据。 正文 Puppeteer 是一个由 Google 开发的 Node.js 库&#xff0c;它提供…

【无标题】读书笔记之《智能化社会:未来人们如何生活、相爱和思考》

《智能化社会&#xff1a;未来人们如何生活、相爱和思考》&#xff1a;Digital vs Human_ how well live, love, and think in the future &#xff0c;由中信出版社于2017年06月出版。作者是澳大利亚的理查德沃特森(Richard Watson)。Richard Watson在伦敦帝国理工学院从事未来…

国债1万亿,你该学点什么

what: 底层逻辑&#xff1a;国家信用向社会募资 why&#xff1a; ① 战争时代-筹措military purpose ② 平衡财政收支&#xff08;大部分时期都是deficit的状态&#xff0c;一般方法有levy.taxing,print money,national debt&#xff0c;当taxing与print money都困难的时候&a…

【Java集合类面试二十】、请介绍LinkedHashMap的底层原理

文章底部有个人公众号&#xff1a;热爱技术的小郑。主要分享开发知识、学习资料、毕业设计指导等。有兴趣的可以关注一下。为何分享&#xff1f; 踩过的坑没必要让别人在再踩&#xff0c;自己复盘也能加深记忆。利己利人、所谓双赢。 面试官&#xff1a;请介绍LinkedHashMap的底…

什么是React中的高阶组件(Higher Order Component,HOC)?它的作用是什么?

聚沙成塔每天进步一点点 ⭐ 专栏简介 前端入门之旅&#xff1a;探索Web开发的奇妙世界 欢迎来到前端入门之旅&#xff01;感兴趣的可以订阅本专栏哦&#xff01;这个专栏是为那些对Web开发感兴趣、刚刚踏入前端领域的朋友们量身打造的。无论你是完全的新手还是有一些基础的开发…

shopee商品链接获取shopee商品评论数据(用 Python实现shopee商品评论信息抓取)

在网页抓取方面&#xff0c;可以使用 Python、Java 等编程语言编写程序&#xff0c;通过模拟 HTTP 请求&#xff0c;获取shopee网站上的商品详情页面评论内容。在数据提取方面&#xff0c;可以使用正则表达式、XPath 等方式从 HTML 代码中提取出有用的信息。值得注意的是&#…

Linux系统安装redis并配置为服务

一、Linux环境 1、下载 官网提供的源码下载地址&#xff1a; https://github.com/redis/redis/archive/7.0.5.tar.gz 2、将源码上传至服务器 3、解压缩 # 将解压缩后的文件放置在同目录的source文件夹下 tar -zxvf redis-7.0.5.tar.gz -C ./source4、编译安装 对源码进行编…

【微信小程序】数字化会议OA系统之投票模块(附源码)

&#x1f389;&#x1f389;欢迎来到我的CSDN主页&#xff01;&#x1f389;&#x1f389; &#x1f3c5;我是Java方文山&#xff0c;一个在CSDN分享笔记的博主。&#x1f4da;&#x1f4da; &#x1f31f;推荐给大家我的专栏《微信小程序开发实战》。&#x1f3af;&#x1f3a…

有粉丝被机器视觉培训机构忽悠培训贷款

最近有13个粉丝私下联系我&#xff0c;咨询我培训贷款&#xff0c;当时我听了&#xff0c;挺懵的。我详细了解后&#xff0c;我上大学毕业的时候&#xff0c;也遇到过此类学校鼓励我们去培训。合理维权&#xff0c;切不可采用极端手段&#xff0c;生命比什么都重要。不要做傻事…