宜昌十堰网站建设哪家好,基于wordpress建小程序JWT,十大ppt模板免费下载网站,广州软件合作中心Eclipse集成MapStruct 在Eclipse中添加MapStruct依赖配置Eclipse支持MapStruct①安装 m2e-aptEclipse Marketplace的方式安装Install new software的方式安装#xff08;JDK8用到#xff09; ②添加到pom.xml 今天拿到同事其他项目的源码#xff0c;导入并运行的时候抛出了异… Eclipse集成MapStruct 在Eclipse中添加MapStruct依赖配置Eclipse支持MapStruct①安装 m2e-aptEclipse Marketplace的方式安装Install new software的方式安装JDK8用到 ②添加到pom.xml 今天拿到同事其他项目的源码导入并运行的时候抛出了异常根据异常定位到Mappers.getMapper()获取不到值后面查了一下发现是Eclipse需要自己手动集成MapStruct插件支持才行同事用的IDEA已经默认支持了MapStruct所以没这个问题。想换IDEA的心越来越强烈了。。。。
在Eclipse中添加MapStruct依赖
这个其实原本项目中本来就有了加上去是为了完整万一哪天自己要加还可以看一下 在pom.xml中添加
...
propertiesorg.mapstruct.version1.5.5.Final/org.mapstruct.version
/properties
...
dependenciesdependencygroupIdorg.mapstruct/groupIdartifactIdmapstruct/artifactIdversion${org.mapstruct.version}/version/dependency
/dependencies
...
buildpluginsplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-compiler-plugin/artifactIdversion3.8.1/versionconfigurationsource1.8/source !-- depending on your project --target1.8/target !-- depending on your project --annotationProcessorPathspathgroupIdorg.mapstruct/groupIdartifactIdmapstruct-processor/artifactIdversion${org.mapstruct.version}/version/path!-- other annotation processors --/annotationProcessorPaths/configuration/plugin/plugins
/build这其实是出自于MapStruct的官网https://mapstruct.org/documentation/installation
配置Eclipse支持MapStruct
可直接参考官网https://mapstruct.org/documentation/ide-support/
①安装 m2e-apt
Eclipse Marketplace的方式安装
eclipse里面Help– Eclipse Marketplace 打开应用市场输入m2e-apt选择m2e-apt 1.5.4最新的点击Installed进行安装 Install new software的方式安装JDK8用到
我自己在Eclipse Marketplace上安装不了提示大概意思JDK要11才行或者11以上。自己用的是JDK8只能找低一点的m2e-apt版本进行安装。
m2e-apt的其他版本地址https://download.jboss.org/jbosstools/updates/m2e-extensions/m2e-apt/ 在Eclipse那里Help–Install new software弹出的框那里点击Add… 在弹出的框那里输入Nanem2eLocation输入要选择m2e-apt的版本地址我的Eclipse是2020-06选择m2e-apt 1.5.3输入m2e-apt 1.5.3的地址 点Add后next进行添加一直往后安装就好这里不截图了。 m2e-apt 的版本地址可以直接从浏览器那里复制如我选择了m2e-apt 1.5.3点到对应的地址是
②添加到pom.xml
安装完后需要在pom.xml那里添加我是在版本依赖的pom.xml那里进行添加
properties!-- automatically run annotation processors within the incremental compilation --m2e.apt.activationjdt_apt/m2e.apt.activation
/properties最后重启一下Eclipse重新运行项目。