Package org.apache.tools.ant.taskdefs

Examples of org.apache.tools.ant.taskdefs.Ant


        File f = getBuildFile(event);
        if (f.exists()) {
            if (onlyOnce && isBuilt(f)) {
                Message.verbose("target build file already built, skipping: " + f);
            } else {
                Ant ant = new Ant();
                Project project = (Project) IvyContext
                        .peekInContextStack(IvyTask.ANT_PROJECT_CONTEXT_KEY);
                if (project == null) {
                    project = new Project();
                    project.init();
                }

                ant.setProject(project);
                ant.setTaskName("ant");

                ant.setAntfile(f.getAbsolutePath());
                ant.setInheritAll(false);
                String target = getTarget();
                if (target != null) {
                    ant.setTarget(target);
                }
                Map atts = event.getAttributes();
                for (Iterator iter = atts.keySet().iterator(); iter.hasNext();) {
                    String key = (String) iter.next();
                    String value = (String) atts.get(key);
                    if (value != null) {
                        Property p = ant.createProperty();
                        p.setName(prefix == null ? key : prefix + key);
                        p.setValue(value);
                    }
                }

                Message.verbose("triggering build: " + f + " target=" + target + " for " + event);
                try {
                    ant.execute();
                } catch (BuildException e) {
                    Message.verbose("Exception occurred while executing target " + target);
                    throw e;
                }
                markBuilt(f);
View Full Code Here


                         final Project project )
        throws BuildException
    {
        validate();

        final Ant ant = (Ant)project.createTask( "ant" );
        ant.setInheritAll( false );
        ant.setAntfile( m_antfile.getName() );

        try
        {
            final File dir =
                m_antfile.getParentFile().getCanonicalFile();
            ant.setDir( dir );
        }
        catch( final IOException ioe )
        {
            throw new BuildException( ioe.getMessage(), ioe );
        }

        if( null != m_target )
        {
            ant.setTarget( m_target );
        }

        ant.execute();

        return m_destfile;
    }
View Full Code Here

    public File resolve(final Extension extension,
                         final Project project)
        throws BuildException {
        validate();

        final Ant ant = (Ant) project.createTask("ant");
        ant.setInheritAll(false);
        ant.setAntfile(m_antfile.getName());

        try {
            final File dir =
                m_antfile.getParentFile().getCanonicalFile();
            ant.setDir(dir);
        } catch (final IOException ioe) {
            throw new BuildException(ioe.getMessage(), ioe);
        }

        if (null != m_target) {
            ant.setTarget(m_target);
        }

        ant.execute();

        return m_destfile;
    }
View Full Code Here

      }
      System.out.println();
    }
   
    for (BuildBundleDescriptor descriptor : buildOrder) {
      Ant antTask = new Ant(this);
      File buildFile = descriptor.getBuildFile();
      System.out.println("Building " + buildFile);
      antTask.setAntfile(buildFile.toString());
      antTask.setDir(buildFile.getParentFile());
      if (buildTarget != null) {
        antTask.setTarget(buildTarget);
      }
      antTask.setInheritAll(inheritAll);
      antTask.setInheritRefs(inheritRefs);
      antTask.execute();
    }
   
  }
View Full Code Here

        File f = getBuildFile(event);
        if (f.exists()) {
            if (onlyOnce && isBuilt(f)) {
                Message.verbose("target build file already built, skipping: " + f);
            } else {
                Ant ant = new Ant();
                Project project = (Project) IvyContext.peekInContextStack(
                    IvyTask.ANT_PROJECT_CONTEXT_KEY);
                if (project == null) {
                    project = new Project();
                    project.init();
                }

                ant.setProject(project);
                ant.setTaskName("ant");

                ant.setAntfile(f.getAbsolutePath());
                ant.setInheritAll(false);
                String target = getTarget();
                if (target != null) {
                    ant.setTarget(target);
                }
                Map atts = event.getAttributes();
                for (Iterator iter = atts.keySet().iterator(); iter.hasNext();) {
                    String key = (String) iter.next();
                    String value = (String) atts.get(key);
                    Property p = ant.createProperty();
                    p.setName(prefix == null ? key : prefix + key);
                    p.setValue(value);
                }

                Message.verbose("triggering build: " + f + " target=" + target + " for " + event);
                try {
                    ant.execute();
                } catch (BuildException e) {
                    Message.verbose("Exception occurred while executing target " + target);
                    e.printStackTrace(); // TODO: remove when finished debugging
                    throw e;
                }
View Full Code Here

        File f = getBuildFile(event);
        if (f.exists()) {
            if (onlyOnce && isBuilt(f)) {
                Message.verbose("target build file already built, skipping: " + f);
            } else {
                Ant ant = new Ant();
                Project project = (Project) IvyContext.getContext().peek(
                    IvyTask.ANT_PROJECT_CONTEXT_KEY);
                if (project == null) {
                    project = new Project();
                    project.init();
                }

                ant.setProject(project);
                ant.setTaskName("ant");

                ant.setAntfile(f.getAbsolutePath());
                ant.setInheritAll(false);
                String target = getTarget();
                if (target != null) {
                    ant.setTarget(target);
                }
                Map atts = event.getAttributes();
                for (Iterator iter = atts.keySet().iterator(); iter.hasNext();) {
                    String key = (String) iter.next();
                    String value = (String) atts.get(key);
                    Property p = ant.createProperty();
                    p.setName(prefix == null ? key : prefix + key);
                    p.setValue(value);
                }

                Message.verbose("triggering build: " + f + " target=" + target + " for " + event);
                MessageImpl impl = IvyContext.getContext().getMessageImpl();
                try {
                    IvyContext.getContext().setMessageImpl(null);
                    try {
                        ant.execute();
                    } catch (BuildException e) {
                        Message.verbose("Exception occurred while executing target " + target);
                        e.printStackTrace(); // TODO: remove when finished debugging
                        throw e;
                    }
View Full Code Here

    File f = getBuildFile(event);
    if (f.exists()) {
      if (_onlyonce && isBuilt(f)) {
        Message.verbose("target build file already built, skipping: "+f);
      } else {
        Ant ant = new Ant();
        Project project = (Project)IvyContext.getContext().get(IvyTask.ANT_PROJECT_CONTEXT_KEY);
        if (project == null) {
          project = new Project();
          project.init();
        }
       
        ant.setProject(project);
        ant.setTaskName("ant");
       
        ant.setAntfile(f.getAbsolutePath());
        ant.setInheritAll(false);
        String target = getTarget();
        if (target != null) {
          ant.setTarget(target);
        }
        Map atts = event.getAttributes();
        for (Iterator iter = atts.keySet().iterator(); iter.hasNext();) {
          String key = (String) iter.next();
          String value = (String) atts.get(key);
          Property p = ant.createProperty();
          p.setName(_prefix == null?key:_prefix+key);
          p.setValue(value);
        }
       
        Message.verbose("triggering build: "+f+" target="+target+" for "+event);
                MessageImpl impl = IvyContext.getContext().getMessageImpl();
                try {
                  IvyContext.getContext().setMessageImpl(null);
                  try {
                    ant.execute();
                  } catch (BuildException e) {
                    Message.verbose("Exception occurred while executing target " + target);
                    e.printStackTrace(); // TODO: remove when finished debugging
                    throw e;
                  }
View Full Code Here

        synchronized (System.class) {
            if (System.getProperty(hash) != null) {
                return;
            }

            Ant ant = (Ant) getProject().createTask("ant");
            ant.setInheritAll(false);
            ant.setOwningTarget(getOwningTarget());
            ant.setTaskName(getTaskName());
            ant.init();
            if (target.length() > 0) {
                ant.setTarget(target);
            }
            ant.setAntfile(path);
            ant.setDir(file.getParentFile());
            ant.execute();

            System.setProperty(hash, "done");
        }
    }
View Full Code Here

    public File resolve(final Extension extension,
                         final Project project)
        throws BuildException {
        validate();

        final Ant ant = (Ant) project.createTask("ant");
        ant.setInheritAll(false);
        ant.setAntfile(m_antfile.getName());

        try {
            final File dir =
                m_antfile.getParentFile().getCanonicalFile();
            ant.setDir(dir);
        } catch (final IOException ioe) {
            throw new BuildException(ioe.getMessage(), ioe);
        }

        if (null != m_target) {
            ant.setTarget(m_target);
        }

        ant.execute();

        return m_destfile;
    }
View Full Code Here

     */
    public File resolve(final Extension extension,
                         final Project project) throws BuildException {
        validate();

        final Ant ant = (Ant) project.createTask("ant");
        ant.setInheritAll(false);
        ant.setAntfile(antfile.getName());

        try {
            final File dir =
                antfile.getParentFile().getCanonicalFile();
            ant.setDir(dir);
        } catch (final IOException ioe) {
            throw new BuildException(ioe.getMessage(), ioe);
        }

        if (null != target) {
            ant.setTarget(target);
        }

        ant.execute();

        return destfile;
    }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.Ant

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.