我通过选择org.apache.maven.archtypes maven.archtype.webapp创建了新的maven项目。
我执行了这个命令,
但maven依赖库未添加到库文件夹中虽然我已经获取了构建成功消息。
[INFO] Scanning for projects...
<p>
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO] BUILD SUCCESS
[INFO] Total time: 2.248 s
[INFO] Finished at: 2018-06-07T09:40:57+03:00
[INFO] Final Memory: 8M/20M
添加了我的pom文件。 E.g dependecy mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype -
<?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.0http://maven.apache. rg/xsd/maven-4.0.0.xsd">
<groupId>test</groupId>
<artifactId>maven.test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>maven.test Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310 -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.9.5</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
这是故障屏幕截图
我的临时解决方案:
但新的java项目并转换为maven项目,这样就可以实现这种方式显示maven依赖