Package org.apache.tools.ant

Examples of org.apache.tools.ant.Project


    assertFalse(model.validate(messages));
    assertTrue(messages.contains(TaskModel.ERROR_ERROR_FILE_CREATION_FAILED));
  }

  public void testGetClassPath() throws Exception {
    Project proj = new Project();
    Path p = new Path(proj);

    proj.setBasedir(".");
    p.setLocation(new File("src-test/com/google/ant"));

    model.addClasspath(p);
    Matcher matcher = Pattern.compile("src-test.com.google.ant").matcher(model.getClassPath());
    assertTrue(matcher.find());
View Full Code Here


  }

  public void testResultFileNotSet() throws Exception {
    List<String> messages = new ArrayList<String>();

    model.addClasspath(new Path(new Project()));
    model.setResultFile(null);
    assertTrue(model.validate(messages));
    assertTrue(messages.contains(TaskModel.ERROR_RESULT_FILE_NOT_SET));
  }
View Full Code Here

  }

  public void testFilterNotSet() throws Exception {
    List<String> messages = new ArrayList<String>();

    model.addClasspath(new Path(new Project()));
    model.setFilter(null);
    assertTrue(model.validate(messages));
    assertTrue(messages.contains(TaskModel.ERROR_FILTER_NOT_SET));
  }
View Full Code Here

  }

  public void testErrorFileSameAsResultFile() throws Exception {
    List<String> messages = new ArrayList<String>();

    model.addClasspath(new Path(new Project()));
    model.setErrorFile(null);
    model.setResultFile(File.createTempFile("anyfile", ".temp").toString());
    assertTrue(model.validate(messages));
    assertEquals(model.getResultFile(), model.getErrorFile());
  }
View Full Code Here

    consoleLogger.setOutputPrintStream(System.out);
    consoleLogger.setMessageOutputLevel(Project.MSG_INFO);

    // execute ant build
    final File buildFile = new File(buildFileStr);
    final Project p = new Project();
    // p.setCoreLoader(getClass().getClassLoader());
    p.addBuildListener(consoleLogger);
    p.setUserProperty("ant.file", buildFile.getAbsolutePath());
    p.setProperty(BUILD_CLASSPATH, buildClasspathStr);
    p.setProperty(BUILD_VERBOSE, buildVerboseStr);
    p.init();
    final ProjectHelper helper = ProjectHelper.getProjectHelper();
    p.addReference("ant.projectHelper", helper);
    helper.parse(p, buildFile);
    final String[] buildTargets = buildTargetStr == null
        || buildTargetStr.isEmpty() ? new String[] { p
        .getDefaultTarget() } : buildTargetStr.split(",");
    for (final String t : buildTargets) {
      if (!t.trim().isEmpty()) {
        System.out.println();
        if (Boolean.parseBoolean(buildVerboseStr)) {
          System.out.println("Executing Target: " + t);
        }
        p.executeTarget(t.trim());
      }
    }
  }
View Full Code Here

            finalName = finalName + archiveType;
        }
        File finalFile = new File( mojo.getOutputDirectory(), finalName );

        // Preparing the Ant project
        Project project = new Project();
        project.setBaseDir( mojo.getOutputDirectory() );

        // ZIP Archive
        if ( archiveType.equalsIgnoreCase( "zip" ) )
        {
            Zip zipTask = new Zip();
View Full Code Here

    public AntBuilder(final Logger log, final IO io) {
        super(createProject(log, io));
    }

    protected static Project createProject(final Logger log, final IO io) {
        Project project = new Project();
        project.addBuildListener(new OutputAdapter(log, io));
        project.init();
        project.getBaseDir();

        return project;
    }
View Full Code Here

    private Project project;

    protected void setUp() throws Exception {
        createCache();
        project = new Project();
        project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml");

        fixDeps = new FixDepsTask();
        fixDeps.setProject(project);
        System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
View Full Code Here

        cleanCache();
    }

    private void cleanCache() {
        Delete del = new Delete();
        del.setProject(new Project());
        del.setDir(cache);
        del.execute();
    }
View Full Code Here

import org.apache.tools.ant.Project;

public class AntTestHelper {
    // this is probably already available in some Ant class or helper...
    public static Project newProject() {
        Project project = new Project();
        DefaultLogger logger = new DefaultLogger();
        logger.setMessageOutputLevel(Project.MSG_INFO);
        logger.setOutputPrintStream(System.out);
        logger.setErrorPrintStream(System.out);
        project.addBuildListener(logger);
        return project;
    }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.Project

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.