我正在尝试更新 IntelliJ 中的依赖项。不幸的是,IntelliJ 总是使用旧版本加载依赖项。
一开始我想知道是因为当我用 Maven 启动它时应用程序运行良好。 但是当我想用 IntelliJ 启动它时,我收到以下错误:
<块引用>IntelliJ Idea mapstruct java:映射处理器中的内部错误: java.lang.NullPointerException
在我尝试过所有解决方案之后,Maven 总是在 Dependency:Tree 中显示旧版本 1.3.1.Final。我尝试过的:
1)我很快发现了一个类似的问题 (IntelliJ Idea mapstruct java: Internal error in the mapping processor: java.lang.NullPointerException)
2) 尝试让 IntelliJ 自动重新加载更改:
3) 尝试让 IntelliJ 自动重新加载更改,试用编号 2:
4) 清除 IntelliJ 中的缓存:
pom 文件的片段:
<properties>
<mapstruct.version>1.4.2.Final</mapstruct.version>
</properties>
...
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<scope>provided</scope>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
<!-- jhipster-needle-maven-add-annotation-processor -->
</annotationProcessorPaths>
</configuration>
</plugin>
编辑:您可以通过 this link.
查看完整的 pom.xml 文件EDIT2:可能是从 Jhipster 依赖项中提取的版本。
Pom 片段:
<!-- Dependency versions -->
<jhipster-dependencies.version>3.9.1</jhipster-dependencies.version>
谢赫:https://mvnrepository.com/artifact/io.github.jhipster/jhipster-dependencies/3.9.1
为什么属性中的显式版本不会覆盖父 pom 的版本(JHipster 依赖)
答案 0 :(得分:1)
您的 POM 没有明确的版本。
属性 <mapstruct.version>1.4.2.Final</mapstruct.version>
只有在某处使用时才有用(它不会自动更改版本)。