當前位置: 首頁>>代碼示例>>Java>>正文


Java Project類代碼示例

本文整理匯總了Java中org.apache.tools.ant.Project的典型用法代碼示例。如果您正苦於以下問題:Java Project類的具體用法?Java Project怎麽用?Java Project使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Project類屬於org.apache.tools.ant包,在下文中一共展示了Project類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: messageLogged

import org.apache.tools.ant.Project; //導入依賴的package包/類
public synchronized void messageLogged(BuildEvent event) {
    final boolean failOnError = isFailOnError(event);
    if (sendException(event, failOnError)) {
        return;
    }

    int priority = event.getPriority();
    if (priority == Project.MSG_ERR && !failOnError) {
        // some ant tasks (like Copy) with 'failOnError' attribute set to 'false'
        // send warnings with priority level = Project.MSG_ERR
        // this heuristic corrects the priority level, so that IDEA considers the message not as an error but as a warning
        priority = Project.MSG_WARN;
    }

    final String message = event.getMessage();

    if (priority == Project.MSG_ERR) {
        myMessagePriority.sendMessage(ERROR, priority, message);
    } else {
        myMessagePriority.sendMessage(MESSAGE, priority, message);
    }
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:23,代碼來源:HybrisIdeaAntLogger.java

示例2: closeRedirector

import org.apache.tools.ant.Project; //導入依賴的package包/類
/**
 * Ask redirector to close all the streams. It is necessary to call this method
 * before leaving the Task to have the Streams flush their contents. If you are 
 * collecting output in a property, it will be created only if this method is
 * called, otherwise you'll find it unset.
 */
protected void closeRedirector() {
    try {
        if (redirectOutput) {
            redirector.complete();
        }
    } catch (IOException ioe) {
        log("Error closing redirector: "
            + ioe.getMessage(), Project.MSG_ERR);
    }
    /*
     * Due to depends chain, Ant could call the Task more than once,
     * this is to prevent that we attempt to reuse the previuosly 
     * closed Streams.
     */
    redirectOutStream = null;
    redirectOutPrintStream = null;
    redirectErrStream = null;
    redirectErrPrintStream = null;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:26,代碼來源:BaseRedirectorHelperTask.java

示例3: isTarget

import org.apache.tools.ant.Project; //導入依賴的package包/類
private boolean isTarget(
    final String propName,
    final File... targets) {
    final Project p = getProject();
    final String propVal = p.getProperty(propName);
    if (propVal == null) {
        return false;
    }
    final File resolvedFile = p.resolveFile(propVal);
    if (resolvedFile == null) {
        return false;
    }
    final File normalizedResolvedFile = FileUtil.normalizeFile(resolvedFile);
    for (File target : targets) {
        if (target == null) {
            continue;
        }
        final File normalizedTarget = FileUtil.normalizeFile(target);
        if (isParentOf(normalizedTarget, normalizedResolvedFile)) {
            return true;
        }
    }
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:DeleteTask.java

示例4: execute

import org.apache.tools.ant.Project; //導入依賴的package包/類
/**
 * Invoke the Hadoop record compiler on each record definition file
 */
@Override
public void execute() throws BuildException {
  if (src == null && filesets.size()==0) {
    throw new BuildException("There must be a file attribute or a fileset child element");
  }
  if (src != null) {
    doCompile(src);
  }
  Project myProject = getProject();
  for (int i = 0; i < filesets.size(); i++) {
    FileSet fs = filesets.get(i);
    DirectoryScanner ds = fs.getDirectoryScanner(myProject);
    File dir = fs.getDir(myProject);
    String[] srcs = ds.getIncludedFiles();
    for (int j = 0; j < srcs.length; j++) {
      doCompile(new File(dir, srcs[j]));
    }
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:23,代碼來源:RccTask.java

示例5: setUp

import org.apache.tools.ant.Project; //導入依賴的package包/類
@Override
protected void setUp() throws Exception {
    clearWorkDir();
    dist = new File(getWorkDir(), "dist");
    dist.mkdirs();
    src = new File(getWorkDir(), "src");
    src.mkdirs();
    
    Project p = new Project();
    task = new LocFiles();
    task.setProject(p);
    task.setCluster("platform");
    task.setLocales("cs");
    task.setPatternSet("pattern.set");
    task.setSrc(src);
    task.setDestDir(dist);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:LocFilesTest.java

示例6: classToSourceURL

import org.apache.tools.ant.Project; //導入依賴的package包/類
private String classToSourceURL (FileObject fo) {
    try {
        ClassPath cp = ClassPath.getClassPath (fo, ClassPath.EXECUTE);
        FileObject root = cp.findOwnerRoot (fo);
        String resourceName = cp.getResourceName (fo, '/', false);
        if (resourceName == null) {
            getProject().log("Can not find classpath resource for "+fo+", skipping...", Project.MSG_ERR);
            return null;
        }
        int i = resourceName.indexOf ('$');
        if (i > 0)
            resourceName = resourceName.substring (0, i);
        FileObject[] sRoots = SourceForBinaryQuery.findSourceRoots 
            (root.getURL ()).getRoots ();
        ClassPath sourcePath = ClassPathSupport.createClassPath (sRoots);
        FileObject rfo = sourcePath.findResource (resourceName + ".java");
        if (rfo == null) return null;
        return rfo.getURL ().toExternalForm ();
    } catch (FileStateInvalidException ex) {
        ex.printStackTrace ();
        return null;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:JPDAReload.java

示例7: processLocale

import org.apache.tools.ant.Project; //導入依賴的package包/類
private void processLocale(String locale, Collection<? super String> toAdd, boolean warn) {
    File baseSrcDir = fileFrom(srcDir, locale);
    if (!baseSrcDir.exists()) {
        if (warn) {
            log("No files for locale: " + locale);
        }
        return;
    }
    log("Found L10N dir " + baseSrcDir, Project.MSG_VERBOSE);
    
    final String moduleDir = findModuleDir(cnbDashes);
    File locBaseDir = fileFrom(baseSrcDir, cluster, moduleDir);
    if (!locBaseDir.exists()) {
        log("Can't find directory " + locBaseDir, Project.MSG_WARN);
        return;
    }
    File[] ch = locBaseDir.listFiles();
    if (ch == null) {
        throw new BuildException("Surprising content of " + locBaseDir);
    }
    for (File f : ch) {
        processLocaleJar(f, locale, toAdd, moduleDir, locBaseDir, baseSrcDir);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:LocFiles.java

示例8: execute

import org.apache.tools.ant.Project; //導入依賴的package包/類
@Override
public void execute() {
    Project p = getProject();

    Properties props = readProperties(propertyFile);
    toolName = props.getProperty("tool.name");
    if (toolName != null) {
        toolArgs = props.getProperty(toolName + ".args", "");
    }

    if (toolProperty == null ||
        askIfUnset && (toolName == null
            || (argsProperty != null && toolArgs == null))) {
        showGUI(props);
    }

    // finally, return required values, if any
    if (toolProperty != null && !(toolName == null || toolName.equals(""))) {
        p.setProperty(toolProperty, toolName);

        if (argsProperty != null && toolArgs != null)
            p.setProperty(argsProperty, toolArgs);
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:SelectToolTask.java

示例9: validateAgainstAUDTDs

import org.apache.tools.ant.Project; //導入依賴的package包/類
static void validateAgainstAUDTDs(InputSource input, final Path updaterJar, final Task task) throws IOException, SAXException {
    XMLUtil.parse(input, true, false, XMLUtil.rethrowHandler(), new EntityResolver() {
        ClassLoader loader = new AntClassLoader(task.getProject(), updaterJar);
        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
            String remote = "http://www.netbeans.org/dtds/";
            if (systemId.startsWith(remote)) {
                String rsrc = "org/netbeans/updater/resources/" + systemId.substring(remote.length());
                URL u = loader.getResource(rsrc);
                if (u != null) {
                    return new InputSource(u.toString());
                } else {
                    task.log(rsrc + " not found in " + updaterJar, Project.MSG_WARN);
                }
            }
            return null;
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:MakeNBM.java

示例10: determineParameter

import org.apache.tools.ant.Project; //導入依賴的package包/類
private boolean determineParameter(File moduleFile, String parameter) throws IOException {
    String name = moduleFile.getName();
    name = name.substring(0, name.length() - 3) + "xml";
    File configFile = new File(moduleFile.getParentFile().getParentFile(), "config/Modules/" + name);
    log ("config " + configFile, Project.MSG_DEBUG);
    if (!configFile.exists())
        return true; // probably a classpath module, treat like autoload
    final String fragment = "<param name=\"" + parameter + "\">true</param>";
    try (BufferedReader br = new BufferedReader (new FileReader (configFile))) {
        String line;
        while ((line = br.readLine ()) != null) {
            if (line.indexOf (fragment) != -1) {
                log ("autoload module: " + moduleFile, Project.MSG_DEBUG);
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:ModuleDependencies.java

示例11: execute

import org.apache.tools.ant.Project; //導入依賴的package包/類
@Override
public void execute() throws BuildException {
    File tmpFile = null;
    try {
        if (isSigned(jar) == null) {
            tmpFile = extendLibraryManifest(getProject(), jar, destJar, codebase, permissions, appName);
        }
    } catch (IOException | ManifestException ex) {
        getProject().log(
                "Failed to extend libraries manifests: " + ex.getMessage(), //NOI18N
                Project.MSG_WARN);
    }
    if (tmpFile != null) {
        sign(tmpFile, destJar);
        deleteTmpFile(tmpFile);
    } else {
        sign(jar, destJar);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:JNLPUpdateManifestStartup.java

示例12: sign

import org.apache.tools.ant.Project; //導入依賴的package包/類
/**
 * Signs the given files according to the signJars variable value.
 */
private void sign(File from, File to) {
    if (!from.exists() && from.getParentFile().getName().equals("locale")) {
        // skip missing locale files, probably the best fix for #103301
        log("Localization file " + from + " is referenced, but cannot be found. Skipping.", Project.MSG_WARN);
        return;
    }
    getSignTask().setJar(from);
    if (to != null) {
        // #125970: might be .../modules/locale/something_ja.jar
        to.getParentFile().mkdirs();
    }
    getSignTask().setSignedjar(to);
    // use reflection for calling getSignTask().setDigestAlg("SHA1");
    getSignTask().setDigestAlg("SHA1");
    getSignTask().execute();

}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:JNLPUpdateManifestBranding.java

示例13: createSourcePath

import org.apache.tools.ant.Project; //導入依賴的package包/類
static ClassPath createSourcePath (
    Project project,
    Path modulepath,
    Path classpath,
    Path sourcepath,
    boolean isSourcePathExclusive
) {
    if (sourcepath != null && isSourcePathExclusive) {
        return convertToClassPath (project, sourcepath);
    }
    ClassPath cp = convertToSourcePath (project, classpath, true);
    ClassPath modulesSources = convertToSourcePath(project, modules(project, modulepath), true);
    ClassPath sp = convertToClassPath (project, sourcepath);

    ClassPath sourcePath = ClassPathSupport.createProxyClassPath (
        new ClassPath[] {cp, modulesSources, sp}
    );
    return sourcePath;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:JPDAStart.java

示例14: loadTextProps

import org.apache.tools.ant.Project; //導入依賴的package包/類
/**
 * Description of the Method
 *
 * @param tp
 */
private void loadTextProps( String tp ) {
    Properties p = new Properties();
    Project project = getProject();
    StringTokenizer st = new StringTokenizer( tp, "$" );
    while ( st.hasMoreTokens() ) {
        String token = st.nextToken();
        int start = token.indexOf( "{" );
        int end = token.indexOf( "}" );
        if ( start > -1 && end > -1 && end > start ) {
            String name = token.substring( start + 1, end - start );
            String value = project.getProperty( name );
            if ( value != null )
                p.setProperty( name, value );
        }
    }
    addProperties( p );
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:23,代碼來源:PostTask.java

示例15: createJDKSourcePath

import org.apache.tools.ant.Project; //導入依賴的package包/類
static ClassPath createJDKSourcePath (
    Project project,
    Path bootclasspath
) {
    if (bootclasspath == null) {
        // if current platform is default one, bootclasspath is set to null
        JavaPlatform jp = JavaPlatform.getDefault();
        if (jp != null) {
            return jp.getSourceFolders ();
        } else {
            return ClassPathSupport.createClassPath(java.util.Collections.EMPTY_LIST);
        }
    } else {
        return convertToSourcePath (project, bootclasspath, false);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:JPDAStart.java


注:本文中的org.apache.tools.ant.Project類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。