我正在开发一个运行在Tomcat上的基于Maven的Web应用程序。我正在尝试将log4j2
依赖项添加到我的maven项目中。然而,当我试图构建我的项目时,底部的错误发生了。我尝试在本地安装log4j
依赖项,但我也无法使其正常工作。我想重新安装Maven,但不知为什么我只能停用它。如果你需要更多的信息,请告诉我,我可以提供。
当我尝试构建项目时输出:
cd C:\...\Blockchain; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_161" cmd /c "\"\"C:\\Program Files\\NetBeans 8.2\\java\\maven\\bin\\mvn.bat\" -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans 8.2\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 install\""
Scanning for projects...
------------------------------------------------------------------------
Building Blockchain 1.0-SNAPSHOT
------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/log4j-core/2.13.0/log4j-core-2.13.0.pom
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 2.069s
Finished at: Mon May 11 21:50:01 CEST 2020
Final Memory: 8M/123M
------------------------------------------------------------------------
Failed to execute goal on project Blockchain: Could not resolve dependencies for project com.bowolfcoin:Blockchain:war:1.0-SNAPSHOT: Failed to collect dependencies for [com.owlike:genson:jar:1.5 (compile), org.apache:log4j-core:jar:2.13.0 (compile), javax:javaee-web-api:jar:7.0 (provided), org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.23 (compile), org.apache.tomcat:tomcat-jasper:jar:8.5.23 (compile), org.glassfish.jersey.containers:jersey-container-servlet:jar:2.0 (compile), org.bouncycastle:bcpkix-jdk15on:jar:1.56 (compile)]: Failed to read artifact descriptor for org.apache:log4j-core:jar:2.13.0: Could not transfer artifact org.apache:log4j-core:pom:2.13.0 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/log4j-core/2.13.0/log4j-core-2.13.0.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
下面是完整的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>com.bowolfcoin</groupId>
<artifactId>Blockchain</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Blockchain</name>
<properties>
<tomcat.version>8.5.23</tomcat.version>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.owlike</groupId>
<artifactId>genson</artifactId>
<version>1.5</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache</groupId>
<artifactId>log4j-core</artifactId>
<version>2.13.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.56</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package com.blockchain.api.services;
import com.blockchain.logic.DependencyManager;
import com.blockchain.logic.PendingTransactions;
import com.blockchain.models.Block;
import com.blockchain.models.Transaction;
import com.blockchain.utils.SHA3Helper;
import org.apache.logging.log4j.core.Logger;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
/**
*
* @author Bongi
*/
@Path("transactions")
public class TransactionService {
private static Logger logger = Logger.getLogger(Transaction.class);
cannot find symbol
symbol: method getLogger(Class<Transaction>)
location: class Logger
您的日志记录工件似乎不正确。你能试试这个吗:
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
您可以在此处确认此路径:https://repo.maven.apache.org/maven2/org/apache/logging/log4j/log4j-core/2.13.0/
另请参阅:https://logging.apache.org/log4j/2.x/maven-artifacts.html
我希望有人面对同样的问题来解决依赖。下面提到的文件 xsi:schemalocation=“http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”xmlns=“http://maven.apache.org/pom/4.0.0”xmlns:xsi=“http://www.w3.org/2001/x
我想通过Jenkins用maven Build运行一个项目。 使用的存储库-Git从存储库中提取代码 使用的构建工具--Maven 我的jenkins控制台输出 请注意:-如果你看不到图像,只需使用Ctrl++缩放即可
我是一名新的Android学习者,我正在为语言翻译制作我的第一个Android应用程序。在添加了一些依赖项之后,我遇到了一些问题。我该怎么解决这个问题? Gradle同步失败:无法解决配置的所有依赖项: app: dedegRuntimeClasspath。无法确定android.arch.lifecycle的工件: livedata: 1.1.1:脱机模式下没有缓存版本有关详细信息,请参阅IDE
现在,我在Maven中显示的依赖项上出现了错误。 我尝试过这里列出的Intellij idea无法解决maven中的任何问题,例如更改maven主目录和自动选择Import maven。我不确定还能是什么。。。此外,该项目最初是在Eclipse中完成的。
我目前正面临这个问题。该项目以前没有任何构建问题。直到今天,当我试图构建它时,才出现了这个错误。 Gradle:配置项目“:project”时出现问题。
我有一个Apache Ivy(版本2.4.0)和Netbean IDE(8.0.2)的设置。我无法解决成熟的maven项目的依赖关系(例如:org.glassfish.jersey)。Apache Ivy成功地解决了更特定模块的依赖关系,如(org.glassfish.jersey.core)。 非工作示例: 工作实例: 常春藤。xml ivysettings。xml build.xml(只是IV