public void compile() throws JiBXException { Compile compiler = new Compile(); String path = generatePath.getAbsolutePath(); if (!path.endsWith(File.separator)) { path = path + File.separator; } List<String> clsPath = new ArrayList<String>(); clsPath.add(compilePath.getAbsolutePath()); clsPath.addAll(Arrays.asList(Utility.getClassPaths())); String[] clsPathSet = clsPath.toArray(new String[clsPath.size()]); String[] bindingSet = new String[] { path + bindingName + ".xml" }; compiler.compile(clsPathSet, bindingSet); }
/** * Finish processing of command line parameters. This adds the JVM classpath directories to the set of paths * specified on the command line. Subclasses which override this method need to call this base class implementation * as part of their processing. * * @param alist Arg list */ protected void finishParameters(ArgList alist) { // add JVM class path directories to those specified on command line String[] vmpaths = Utility.getClassPaths(); for (int i = 0; i < vmpaths.length; i++) { m_classPaths.add(vmpaths[i]); } // set paths to be used for loading referenced classes String[] parray = (String[])m_classPaths.toArray(new String[m_classPaths.size()]); ClassCache.setPaths(parray); ClassFile.setPaths(parray); }
@TaskAction public void compile() { try { String[] pathes = classPathsSupplier.get(); String[] files = bindingsSupplier.get(); project.getLogger().info("---------Jibx ClassPaths---"); for (String path : pathes) { project.getLogger().info(path); } for (String file : files) { project.getLogger().info(file); } Compile compiler = new Compile(); compiler.setLoad(this.load); compiler.setVerbose(this.verbose); compiler.compile(pathes, files); } catch (Exception e) { e.printStackTrace(); } }
for (Iterator iter = binddefs.iterator(); iter.hasNext();) { String bpath = (String)iter.next(); String name = Utility.fileName(bpath); File file = new File(bpath); try { FileInputStream is = new FileInputStream(file); try { ValidationContext vctx = new ValidationContext(parms.getLocator()); BindingElement binding = BindingElement.validateBinding(name, url, is, vctx); if (vctx.getErrorCount() == 0 && vctx.getFatalCount() == 0) { bindings.add(binding); } else {