我使用menu创建了一个eclipse版本的动态web应用程序:1。之后,我使用configure -> convert to maven project将其转换为maven项目。然后我做了maven->Add dependency,然后搜索log4j。
添加后,将鼠标悬停在log4j的标记上,它会显示缺失的工件log4j:log4j:bundle:1.2.17。我不能使用maven更新依赖项。如何修复它?还请解释错误的原因。
下面是添加log4j后生成的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>Healthcare</groupId>
<artifactId>Healthcare</artifactId>
<version>0.0.1-HEALTHCARE</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<type>bundle</type>
</dependency>
</dependencies>
</project>发布于 2014-02-07 01:43:33
First why did you changed the default source folder location? The default is src/main/java and for webapp src/main/webapp。除此之外,Maven Central上不存在用于log4j的包,只需从您的依赖项中删除<type>bundle</type>,因为在Maven Central中只有一个jar可用。
发布于 2014-04-03 23:27:42
我总是做下面的小把戏:
在依赖项管理中,我编辑了依赖项属性(选择有问题的依赖项并单击属性按钮),将类型从bundled更改为jar,从而修复了问题。
好吧,我希望这个解决方案对你有效:)尊敬,
发布于 2016-12-31 00:09:36
请检查依赖项是否正确或是否丢失。
<properties>
<springframework.version>4.2.1.RELEASE</springframework.version>
<jackson.version>2.5.3</jackson.version>
<log4j.version>1.2.17</log4j.version>
</properties>https://stackoverflow.com/questions/21609093
复制相似问题