~安装Apache maven http://maven.apache.org/download.cgj
~Maven教程(1)–maven的下载、安装与配置 https://www.cnblogs.com/platycoden/p/8313503.html
问题1:‘version’ child tag should be defined Inspects a Maven model for solution problems
解决方法:https://blog.csdn.net/lishaoran369/article/details/53994601
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>springboot.examples</groupId>
<artifactId>spring-boot-hello</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.2.RELEASE</version>
</dependency>
</dependencies>
</project>
问题2:在写pom.xml时,partent标签里面的字是红色的。
解决方法:右下角会出现是否要导入**的信息,选择第一个按钮,字体上的红色会消失。(因为在pom.xml中有写错的地方)
问题3:写启动类时,出现了无法导入包的问题。 如下图所示:
解决方法: 1、2、4处红色出现红色,是因为pom.xml写错了代码。
第三处红色出现红色,是因为@SpringBootApplication写成了@SpringApplication
把import org.springframework.boot.autoconfigure.SpringBootApplication;
写成了import org.springframework.boot.autoconfigure.SpringApplication;
关于IDEA中maven配置的问题:
http://www.cnblogs.com/ramantic/p/7735323.html
针对博客中的最后一句话,为什么务必确保相同呢?
通过以上的三步配置,Maven 和 IDEA 的结合使用就比较有条理了,特别强调的是务必要将依赖包的位置进行统一,避免重复下载。
springboot入门—入口类注解@SpringBootApplication解析
https://blog.csdn.net/qq_32198005/article/details/78112812?locationNum=7&fps=1
小结:
照着书,写了pom.xml还有主类(启动类)。然后在浏览器中输入http://localhost:8080/ 即可输入hello
(《深入实践springboot》陈韶健 著, 1.3节使用springboot中的1.3.1节)
pom.xml的程序
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>springboot.examples</groupId>
<artifactId>spring-boot-hello</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.3.2.RELEASE</version>
</dependency>
</dependencies>
</project>
启动类的程序
package springboot.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
@RestController
public class Application {
@RequestMapping("/")
String home(){
return "hello";
}
public static void main(String[] args){
SpringApplication.run(Application.class,args);
}
}
下载了maven安装包
然后配置环境变量,在cmd中输入
maven -v
测试是否安装成功
然后要修改conf里面的settings.xml
将标签<>中的路径改为D:\apache-maven-3.5.4\repository (repository文件夹是自己建的)
打开IDEA,找到File–>Settings
其中,Local resposity 要和settings.xml中写的一致。(依赖包的位置要统一)
( resposity 知识库)
在安装eclipse时遇到的问题(不知道自己安装的版本对不对,在官网上下载,用的是eclipse jee photon,目前没有问题。)
eclipseinstaller by Oomph
Artifact download is progressing very slowly from **
Eclipse IDE for Java EE Developers
Tools for Java developers creating Java EE and Web applications, including a Java IDE, tools for Java EE, JPA, JSF, Mylyn, EGit and others.
(Eclipse 的安装告一段落……)