gpt4 book ai didi

java - 在 IntelliJ 中运行项目

转载 作者:行者123 更新时间:2023-12-02 04:32:17 25 4
gpt4 key购买 nike

我有一个基于 Maven + Spring 的应用程序。这是一个使用 Java 的 Java Web 应用程序。

这是我正在使用的 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.alfred</groupId>
<artifactId>alfred</artifactId>
<version>v.0.1-CID.Fase.II.Edesk-SNAPSHOT</version>
<packaging>war</packaging>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.7.RELEASE</version>
</parent>

<name>ALFRED</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>

<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
</dependency>

<!-- Dependencia para Spring DATA JPA con base de datos -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>


<!-- Para implementar las conexiones a la base de datos MySQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!-- version>5.1.35</version -->
</dependency>


<!-- Para implementar el servicio REST -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<!-- http://mvnrepository.com/artifact/com.google.code.gson/gson -->

<!-- Paquete que permite convertir el contenido de una respuesta en texto
plano JSON a objetos Java. -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>


<!-- Para implementar cliente REST con Template -->
<!-- dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId>
</dependency -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<!-- Para implementar las plantillas HTML con thymeleaf -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<!-- https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-springsecurity3 -->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity3</artifactId>
</dependency>

<!-- Para poder implementar los clientes de los servicios REST -->
<dependency>
<groupId>com.squareup.retrofit</groupId>
<artifactId>retrofit</artifactId>
<version>1.7.1</version>
</dependency>

<!-- Para escapar HTML en las llamadas a la API de IMDB -->
<!-- http://mvnrepository.com/artifact/commons-httpclient/commons-httpclient -->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.0</version>
</dependency>

<!-- Spring Security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>

<!-- Java Mail API -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.3</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-ldap -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>

<!-- Librería para tratar con excels -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.16</version>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!--<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId>
<configuration> DO NOT include log4j.properties file in your Jar <excludes>
<exclude>**/log4j.properties</exclude> </excludes> <archive> </archive> </configuration>
</plugin> -->
</plugins>
</build>


</project>

当我执行清理、生成资源和安装时出现此错误并且无法开始工作

"C:\Program Files\Java\jdk1.8.0_151\bin\java" -Dmaven.multiModuleProjectDirectory=C:\Users\spainasg\Documents\CID_UAT -Dmaven.home=C:\Users\spainasg\Downloads\apache-maven-3.5.2-bin\apache-maven-3.5.2 -Dclassworlds.conf=C:\Users\spainasg\Downloads\apache-maven-3.5.2-bin\apache-maven-3.5.2\bin\m2.conf -Dfile.encoding=UTF-8 -classpath C:\Users\spainasg\Downloads\apache-maven-3.5.2-bin\apache-maven-3.5.2\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2017.2.6 --offline -s C:\Users\spainasg.m2\settings.xml -Dmaven.repo.local=C:\Users\spainasg.m2\repository clean generate-resources install [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.alfred:alfred:war:v.0.1-CID.Fase.II.Edesk-SNAPSHOT [WARNING] Detected profiles.xml alongside com.alfred:alfred:v.0.1-CID.Fase.II.Edesk-SNAPSHOT, this file is no longer supported and was ignored, please use the settings.xml instead [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building ALFRED v.0.1-CID.Fase.II.Edesk-SNAPSHOT [INFO] ------------------------------------------------------------------------ [WARNING] The POM for org.apache.maven.plugins:maven-install-plugin:jar:2.5.2 is missing, no dependency information available [WARNING] The POM for com.oracle:ojdbc14:jar:10.2.0.4.0 is missing, no dependency information available [WARNING] The POM for org.thymeleaf.extras:thymeleaf-extras-springsecurity3:jar:2.1.2.RELEASE is missing, no dependency information available [WARNING] The POM for org.apache.poi:poi:jar:3.16 is missing, no dependency information available [WARNING] The POM for org.apache.poi:poi-ooxml-schemas:jar:3.16 is missing, no dependency information available [WARNING] The POM for com.github.virtuald:curvesapi:jar:1.04 is missing, no dependency information available [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ alfred --- [INFO] Deleting C:\Users\spainasg\Documents\CID_UAT\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ alfred --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] Copying 90 resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ alfred --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 174 source files to C:\Users\spainasg\Documents\CID_UAT\target\classes [WARNING] /C:/Users/spainasg/Documents/CID_UAT/src/main/java/com/edesk/controladorGUI/GestionServicioAprobadorController.java: C:\Users\spainasg\Documents\CID_UAT\src\main\java\com\edesk\controladorGUI\GestionServicioAprobadorController.java uses unchecked or unsafe operations. [WARNING] /C:/Users/spainasg/Documents/CID_UAT/src/main/java/com/edesk/controladorGUI/GestionServicioAprobadorController.java: Recompile with -Xlint:unchecked for details. [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ alfred --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\spainasg\Documents\CID_UAT\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ alfred --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.17:test (default-test) @ alfred --- [WARNING] The POM for org.apache.maven.surefire:maven-surefire-common:jar:2.17 is missing, no dependency information available [WARNING] The POM for org.apache.maven.surefire:surefire-api:jar:2.17 is missing, no dependency information available [WARNING] The POM for org.apache.maven:maven-toolchain:jar:2.0.9 is missing, no dependency information available [WARNING] The POM for org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.2 is missing, no dependency information available [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.961 s [INFO] Finished at: 2017-11-30T09:45:30+01:00 [INFO] Final Memory: 29M/233M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project alfred: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.17 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven.surefire:maven-surefire-common:jar:2.17, org.apache.maven.surefire:surefire-api:jar:2.17, org.apache.maven:maven-toolchain:jar:2.0.9, org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.2, org.codehaus.plexus:plexus-utils:jar:1.1: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.apache.maven.surefire:maven-surefire-common:jar:2.17 has not been downloaded from it before. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException [ERROR] Maven execution terminated abnormally (exit code 1)

我正在使用 IntelliJ,但使用 Eclipse 时出现同样的错误。应用程序正在离线工作。

对这个解决方案有什么想法吗?

最佳答案

尝试添加所有缺少的依赖项。

[WARNING] The POM for org.apache.maven.surefire:maven-surefire-common:jar:2.17 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.surefire:surefire-api:jar:2.17 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-toolchain:jar:2.0.9 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.2 is missing, no dependency information available

关于java - 在 IntelliJ 中运行项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47570306/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com