开发者社区> 问答> 正文

mvn install命令时,一直报错:不兼容的类型 [ERROR] 找到: j?报错

运行环境是64位的win7,maven是3.0.5,jdk是1.6.0_43.


mvn clean命令时,是能够清理的,但执行mvn install命令时,一直报这个错,求大神指引!!!非常感谢!!!


[INFO] Scanning for projects...


[WARNING] 
[WARNING] Some problems were encountered while building the effective model for cn.eshore.btsp:mobileApp:war:1.0.0
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-checkstyle-plugin is missing. @ line 529, column 12
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building mobileApp 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ mobileApp ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\workspace\mobileAssist\mobileApp\src\conf
[INFO] Copying 4 resources
[INFO] Copying 6 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ mobileApp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1450 source files to E:\workspace\mobileAssist\mobileApp\target\classes
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING : 
[INFO] -------------------------------------------------------------
[WARNING] /E:/workspace/mobileAssist/mobileApp/src/main/java/cn/eshore/btsp/mobile/service/oaSys/SecurityTool.java:[17,16] E:\workspace\mobileAssist\mobileApp\src\main\java\cn\eshore\btsp\mobile\service\oaSys\SecurityTool.java:17: 警告:sun.misc.BASE64Encoder 是 Sun 的专用 API,可能会在未来版本中删除
.....................
此处省略了113行同样的报错
........................
[WARNING] /E:/workspace/mobileAssist/mobileApp/src/main/java/cn/eshore/btsp/mobile/security/impl/RSAImpl.java:[152,37] E:\workspace\mobileAssist\mobileApp\src\main\java\cn\eshore\btsp\mobile\security\impl\RSAImpl.java:152: 警告:sun.misc.BASE64Decoder 是 Sun 的专用 API,可能会在未来版本中删除
[WARNING] 注意:某些输入文件使用或覆盖了已过时的 API。
[WARNING] 注意:要了解详细信息,请使用 -Xlint:deprecation 重新编译。
[WARNING] 注意:某些输入文件使用了未经检查或不安全的操作。
[WARNING] 注意:要了解详细信息,请使用 -Xlint:unchecked 重新编译。
[INFO] 63 warnings 
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /E:/workspace/mobileAssist/mobileApp/src/main/java/cn/eshore/btsp/mobile/dao/impl/GenericHibernateDao.java:[622,59] E:\workspace\mobileAssist\mobileApp\src\main\java\cn\eshore\btsp\mobile\dao\impl\GenericHibernateDao.java:622: 不兼容的类型
找到: java.lang.Object
需要: int
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.909s
[INFO] Finished at: Thu Apr 21 16:08:10 CST 2016
[INFO] Final Memory: 24M/379M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project mobileApp: Compilation failure
[ERROR] /E:/workspace/mobileAssist/mobileApp/src/main/java/cn/eshore/btsp/mobile/dao/impl/GenericHibernateDao.java:[622,59] E:\workspace\mobileAssist\mobileApp\src\main\java\cn\eshore\btsp\mobile\dao\impl\GenericHibernateDao.java:622: 不兼容的类型
[ERROR] 找到: java.lang.Object
[ERROR] 需要: int
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException


展开
收起
爱吃鱼的程序员 2020-06-09 15:43:05 966 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    错误不是很明显吗错误指向下面的这个方法~executeSQL错误指向这里~但编译是没报错的~
    publicintexecuteSQL(Stringsql){
    finalStringtempsql=sql;
    returnthis.getHibernateTemplate().execute(newHibernateCallback(){
    publicObjectdoInHibernate(Sessionsession)throwsHibernateException{
    returnsession.createSQLQuery(tempsql).executeUpdate();
    }
    });
    }
    <divclass='ref'>

    引用来自“purplerattle”的评论

    错误指向这里~但编译是没报错的~
    publicintexecuteSQL(Stringsql){
    finalStringtempsql=sql;
    returnthis.getHibernateTemplate().execute(newHibernateCallback(){
    publicObjectdoInHibernate(Sessionsession)throwsHibernateException{
    returnsession.createSQLQuery(tempsql).executeUpdate();
    }
    });
    }
     
    • <spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"><plugin><spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"><artifactId><spanstyle="font-size:9pt;line-height:1.5;">maven-compiler-plugin<spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"></artifactId><spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"><version><spanstyle="font-size:9pt;line-height:1.5;">3.1<spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"></version><spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"><configuration><spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"><source><spanstyle="font-size:9pt;line-height:1.5;">1.6<spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"></source><spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"><target><spanstyle="font-size:9pt;line-height:1.5;">1.6<spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"></target><spanstyle="font-size:9pt;line-height:1.5;color:#808080;"><spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"><encoding><spanstyle="font-size:9pt;line-height:1.5;">${project.build.sourceEncoding}<spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"></encoding><spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"></configuration><spanstyle="font-size:9pt;line-height:1.5;color:#E8BF6A;"></plugin>

    指定编译的版本就不会这样了

    已经像你一样指定了1.6的JDK,还是报错~~~这错误提示都这么明显了 你应该知道怎么改吧<imgsrc="http://static.oschina.net/uploads/space/2016/0422/094543_N8KF_1447756.png"alt="">返回了一个对象,定义的返回类型是int

    自己将Object类型强转成int类型,编译过了,但同事的工作区,没人工转,但也编译过了<imgsrc="http://www.oschina.net/js/ke/plugins/emoticons/images/3.gif"alt="">

    publicintexecuteSQL(Stringsql){

    finalStringtempsql=sql;

    ObjectresultStr= this.getHibernateTemplate().execute(newHibernateCallback(){
    publicObjectdoInHibernate(Sessionsession)throwsHibernateException{
    returnsession.createSQLQuery(tempsql).executeUpdate();
    }
    });
    //TODOlaigl
    returnInteger.parseInt(String.valueOf(resultStr));

    }

    2020-06-09 15:43:24
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载