我正在构建一个 Dropwizard 项目。 (以:https://dropwizard.github.io/dropwizard/getting-started.html 开头)
我在 eclipse 中创建了一个项目,但不明白为什么我得到“无法解析”。
这是错误:
这是 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>foo.bar.app</groupId>
<artifactId>mvn-test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mvn-test</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<dropwizard.version>INSERT VERSION HERE</dropwizard.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>${dropwizard.version}</version>
</dependency>
</dependencies>
</project>
有人可以帮忙吗? 我不知道如何导入包,我真的不知道maven依赖。 谢谢。
最佳答案
您必须在 pom.xml 之间定义 ${dropwizard.version} 标记,如下所示:
<properties>
<dropwizard.version>0.7.0</dropwizard.version>
</properties>
关于java - 为什么我的maven项目无法解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27377087/