我一直在尝试迁移自己开发的Maven项目。我在运行时遇到以下错误
./gradlew clean build
以下是我遇到的错误
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not resolve com.fasterxml:classmate:1.3.4.
Required by:
project : > org.springframework.boot:spring-boot-starter-web:2.1.1.RELEASE > org.hibernate.validator:hibernate-validator:6.0.13.Final
project : > org.springframework.boot:spring-boot-starter-data-jpa:2.1.1.RELEASE > org.hibernate:hibernate-core:5.3.7.Final
> Could not resolve com.fasterxml:classmate:1.3.4.
> Could not get resource 'http://repo.maven.apache.org/maven2/com/fasterxml/classmate/1.3.4/classmate-1.3.4.pom'.
> Could not HEAD
'http://repo.maven.apache.org/maven2/com/fasterxml/classmate/1.3.4/classmate-1.3.4.pom'.
Received status code 501 from server: HTTPS Required
> Could not resolve net.bytebuddy:byte-buddy:1.8.17.
Required by:
project : > org.springframework.boot:spring-boot-starter-data-jpa:2.1.1.RELEASE > org.hibernate:hibernate-core:5.3.7.Final
> Skipped due to earlier error
> Could not resolve org.apache.tomcat:tomcat-annotations-api:9.0.13.
Required by:
project : > org.springframework.boot:spring-boot-starter-tomcat:2.1.1.RELEASE > org.apache.tomcat.embed:tomcat-embed-core:9.0.13
> Skipped due to earlier error
下面是我的pom.xml
<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>project</groupId>
<artifactId>FantasyAnalysis</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>FantasyAnalysis Maven Webapp</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap-datepicker</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>FantasyAnalysis</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
下面是我的build.gradle
plugins {
id 'java'
id 'maven'
id 'war'
}
repositories {
mavenLocal()
maven {
url = 'http://repo.maven.apache.org/maven2'
}
}
dependencies {
compile 'org.springframework:spring-webmvc:5.1.3.RELEASE'
compile 'org.springframework:spring-context:5.1.3.RELEASE'
compile 'org.springframework:spring-context-support:5.1.3.RELEASE'
compile 'org.springframework:spring-beans:5.1.3.RELEASE'
compile 'org.springframework:spring-jdbc:5.1.3.RELEASE'
compile 'org.springframework:spring-test:5.1.3.RELEASE'
compile 'org.springframework:spring-core:5.1.3.RELEASE'
compile 'org.springframework:spring-orm:5.1.3.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-web:2.1.1.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-data-jpa:2.1.1.RELEASE'
compile 'org.springframework.boot:spring-boot-starter-security:2.1.1.RELEASE'
compile 'org.webjars:bootstrap-datepicker:1.0.1'
compile 'org.webjars:jquery:1.9.1'
compile 'javax.mail:javax.mail-api:1.6.2'
compile 'javax.mail:mail:1.4.7'
runtime 'org.springframework.boot:spring-boot-devtools:2.1.1.RELEASE'
runtime 'mysql:mysql-connector-java:8.0.13'
runtime 'com.h2database:h2:1.4.197'
testCompile 'junit:junit:4.12'
testCompile 'org.springframework.boot:spring-boot-starter-test:2.1.1.RELEASE'
testCompile 'org.springframework.security:spring-security-test:5.1.2.RELEASE'
providedCompile 'javax.servlet:servlet-api:2.5'
providedCompile 'javax.servlet:jstl:1.2'
providedCompile 'org.springframework.boot:spring-boot-starter-tomcat:2.1.1.RELEASE'
providedCompile 'org.apache.tomcat.embed:tomcat-embed-jasper:9.0.13'
}
group = 'project'
version = '0.0.1-SNAPSHOT'
description = 'FantasyAnalysis Maven Webapp'
sourceCompatibility = '1.8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
关于如何解决错误的任何想法?我是新手,没有太多经验。任何帮助表示赞赏
答案 0 :(得分:0)
您使用了以下存储库:
http://repo.maven.apache.org/maven2/
该错误明确表明必须使用https:
Received status code 501 from server: HTTPS Required
改为使用以下内容:
https://repo.maven.apache.org/maven2/
请注意,此存储库称为Maven Central,并且gradle有一个快捷方式:Declaring repositories - Maven Central