When the ant command line method is used to execute build javac to compile the class, the type parameter of <X> X cannot be determined if the generic type cannot be converted; for the maximum value of X, java. lang. the Object type variable X does not have a unique maximum instance solution: You need to use eclipse's jdt to compile the class and cannot use the default javac compilation method. Find org. eclipse. jdt. in core_3.5.2.v_981_R35x.jar, find jdtCompilerAdapter. jar and org. eclipse. jdt. compiler. tool_1.0.100.v_972_R35x.jar org. eclipse. jdt. core_3.5.2.v_981_R35x.jar org. eclipse. jdt. debug. ui_3.4.1.v20090811_r351.jar jdtCompilerAdapter. jar and copy it to ant_home/lib. In ant build. add <property name = "build. compiler "value =" org. eclipse. jdt. core. JDTCompilerAdapter "/> <javac nowarn =" false "debug =" true "debuglevel =" source, lines, vars "destdir =" $ {dist. path}/classes "source =" 1.6 "target =" 1.6 "encoding =" UTF-8 "fork =" true "memoryMaximumSize =" 512 m "includeantruntime =" false "> or <javac compiler = "org. eclipse. jdt. core. JDTCompilerAdapter "nowarn =" false "debug =" true "debuglevel =" source, lines, vars "destdir =" $ {dist. path}/classes "source =" 1.6 "target =" 1.6 "encoding =" UTF-8 "fork =" true "memoryMaximumSize =" 512 m "includeantruntime =" false "/> If yes use eclipse to run the ant script, right-click the menu and select start build from RUN as Ant. in xml, select Runtime jRE: run in the same JRE as workspace in the dialog box. image
Remember to introduce the jar packages required above