zoukankan      html  css  js  c++  java
  • Q开头的类找不到,无法加载插件:com.mysema.maven:apt-maven-plugin

    http://www.jspxcms.com/documentation/297.html

    如果出现无法加载com.mysema.maven:apt-maven-plugin插件的情况,通常是由于maven插件仓库的问题。所有Q开头的类(如QInfo、QNode、QVoteMark等)找不到,都是由于这个问题导致。Q开头的类式QueryDSL生成的用于查询的类,位于src/generated-sources/java。由于src/generated-sources/java并不是默认的源码路径,如果com.mysema.maven:apt-maven-plugin插件没有正常加载,这个路径下的源码不会被识别,从而出现找不到类的情况;如果该插件正常加载,则会自动把src/generated-sources/java作为源码路径,一切都将正常工作。

    错误信息通常为:

    Execution default of goal com.mysema.maven:apt-maven-plugin:1.1.3:process failed: Unable to load the mojo 'process' (or one of its required components) from the plugin 'com.mysema.maven:apt-maven-plugin:1.1.3' (com.mysema.maven:apt-maven-plugin:1.1.3:process:default:generate-sources)
    

    由于maven依赖包仓库和maven插件仓库的配置并不是同一个地方,很容易被忽略。maven依赖包仓库通过mirror配置,而maven插件仓库则通过profile的pluginRepository配置。

    完整配置如下:

    <?xml version="1.0" encoding="UTF-8"?>
    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
      <!--<localRepository>D:/repositories/maven</localRepository>-->
      <pluginGroups></pluginGroups>
      <proxies></proxies>
      <servers></servers>
      <mirrors>
        <mirror>
          <id>central</id>
          <mirrorOf>*</mirrorOf>
          <name>Nexus Aliyun</name>
          <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        </mirror>
      </mirrors>
      <!-- 注意:以下配置用于指定Maven插件的仓库,不能省略,否则可能出现无法加载Maven插件的问题(如:`com.mysema.maven:apt-maven-plugin`) -->
      <profiles>
        <profile>
          <id>nexus</id>
          <repositories>
            <repository>
              <id>nexus-repo</id>
              <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
              <releases><enabled>true</enabled></releases>
              <snapshots><enabled>true</enabled></snapshots>
            </repository>
          </repositories>
          <pluginRepositories>
            <pluginRepository>
              <id>nexus-repo</id>
              <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
              <releases><enabled>true</enabled></releases>
              <snapshots><enabled>true</enabled></snapshots>
            </pluginRepository>
          </pluginRepositories>
        </profile>
      </profiles>
      <activeProfiles>
        <activeProfile>nexus</activeProfile>
      </activeProfiles>
    </settings>
    

    修改完配置后,需要在eclipse里面重新加载maven配置Window -> Preferences -> Maven -> User Settings点击Update settings,最好再重启一下eclipse,然后右击项目名 - Maven - Update Project更新项目。

    如果使用IDEA开发工具,还需要打开View -> Tool Windows -> Maven Projects,点击Generate Sources and Update Folders For All Projects

    如果实在无法解决这个问题,还有一个更暴力的方式,在pom.xml文件中删除com.mysema.maven:apt-maven-plugin配置:

    <plugin>
        <groupId>com.mysema.maven</groupId>
        <artifactId>apt-maven-plugin</artifactId>
    </plugin>
    

    然后将src/generated-sources/java目录的文件全部拷贝至src/main/java目录中。

    博客地址:https://blog.csdn.net/xiang__liu,https://www.cnblogs.com/xiang--liu/
  • 相关阅读:
    nas存储服务器硬盘出现故障离线导致磁盘阵列失效、服务器无法访问的数据恢复案例
    【北亚vSAN数据恢复案例】异常断电导致vSAN底层数据损坏的数据恢复
    【Vsan数据恢复】供电不稳服务器非正常关机导致vsan架构中虚拟机磁盘文件丢失的数据恢复
    随机数
    字符串和数组截取.....某人可以看看这个,希望能帮到你,
    利用angular与后台的交互
    AngularJS 深入理解 $scope
    angular 后台交换实例
    alert()、confirm()和prompt()的区别与用法
    ReactJs入门教程
  • 原文地址:https://www.cnblogs.com/xiang--liu/p/11453621.html
Copyright © 2011-2022 走看看