Same source code, Eclipse build success but Maven (javac) fails

前端 未结 4 753
鱼传尺愫
鱼传尺愫 2021-02-15 11:07

Keep getting this error when compiling using Maven:

type parameters of X cannot be determined; no unique maximal instance exists for type variable X wit         


        
4条回答
  •  野性不改
    2021-02-15 11:32

    I met the same error,use ant. Because when compile by ant or maven,javac use JDK to compile.But in eclipse,it has JDT,that can compile success.

    I add below script in my build.xml file: Then,ant can build success.

    I am not familiar with Maven. Maybe,it can set the compiler?

    In my source code,there are many code like this: public X find(String hql, Object... values) { return (X) HibernateUtils.createQuery(getSession(), hql, values).uniqueResult(); }

    Maybe your code too.

    But,use JDT,the success is't the final success,in ant. build.xml can build success only in eclipse. when I run ant from windows command,fail. Throw another error: Class not found: org.eclipse.jdt.core.JDTCompilerAdapter

    PS, I have copy jar files about JDT in eclipse plugin to ant_home/lib directory.

    Wish a little help to you.And our problem can solve.

提交回复
热议问题