Maven依赖项在代码中不可用

时间:2019-05-25 12:01:46

标签: maven intellij-idea

我已经在IntelliJ Idea中导入了一个maven项目。一切似乎都很好,但是没有找到依赖项。

我已经尝试重新导入该项目。尝试重新启动IntelliJ。 mvn Dependency:tree命令显示pom中所有可用的依赖项。

mvn dependency:tree
[INFO] Scanning for projects...
[INFO] gitflow-incremental-builder is disabled.
[INFO] 
[INFO] ---------------------< com.baeldung:cascade-type >----------------------
[INFO] Building cascade-type 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ cascade-type ---
[INFO] com.baeldung:cascade-type:jar:1.0.0-SNAPSHOT
[INFO] +- org.hibernate:hibernate-core:jar:5.3.7.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] |  +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] |  +- org.javassist:javassist:jar:3.23.1-GA:compile
[INFO] |  +- net.bytebuddy:byte-buddy:jar:1.8.17:compile
[INFO] |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.1.1.Final:compile
[INFO] |  +- org.jboss:jandex:jar:2.0.5.Final:compile
[INFO] |  +- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] |  +- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] |  +- org.dom4j:dom4j:jar:2.1.1:compile
[INFO] |  \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.4.Final:compile
[INFO] +- org.assertj:assertj-core:jar:3.8.0:test
[INFO] +- com.h2database:h2:jar:1.4.197:compile
[INFO] +- org.hibernate:hibernate-validator:jar:5.3.3.Final:compile
[INFO] |  \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] +- javax.el:javax.el-api:jar:2.2.5:compile
[INFO] +- org.glassfish:javax.el:jar:3.0.1-b08:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] +- ch.qos.logback:logback-classic:jar:1.1.7:compile
[INFO] +- ch.qos.logback:logback-core:jar:1.1.7:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[INFO] +- junit:junit:jar:4.12:test
[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.4.2:test
[INFO] |  +- org.apiguardian:apiguardian-api:jar:1.0.0:test
[INFO] |  \- org.junit.platform:junit-platform-engine:jar:1.4.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-params:jar:5.4.2:test
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.4.2:test
[INFO] |  +- org.opentest4j:opentest4j:jar:1.1.1:test
[INFO] |  \- org.junit.platform:junit-platform-commons:jar:1.4.2:test
[INFO] +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] +- org.hamcrest:hamcrest-all:jar:1.3:test
[INFO] +- org.mockito:mockito-core:jar:2.21.0:test
[INFO] |  +- net.bytebuddy:byte-buddy-agent:jar:1.8.15:test
[INFO] |  \- org.objenesis:objenesis:jar:2.6:test
[INFO] \- org.apache.maven.surefire:surefire-logger-api:jar:2.22.0:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.583 s
[INFO] Finished at: 2019-05-25T13:52:34+02:00

我不能使用任何依赖项中的任何类。任何帮助将不胜感激。

0 个答案:

没有答案