本文整理了Java中org.apache.tools.ant.Project.setBaseDir()
方法的一些代码示例,展示了Project.setBaseDir()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.setBaseDir()
方法的具体详情如下:
包路径:org.apache.tools.ant.Project
类名称:Project
方法名:setBaseDir
[英]Set the base directory for the project, checking that the given file exists and is a directory.
[中]设置项目的基本目录,检查给定文件是否存在并且是否为目录。
代码示例来源:origin: org.apache.ant/ant
/**
* Set the base directory for the project, checking that
* the given filename exists and is a directory.
*
* @param baseD The project base directory.
* Must not be <code>null</code>.
*
* @exception BuildException if the directory if invalid.
*/
public void setBasedir(final String baseD) throws BuildException {
setBaseDir(new File(baseD));
}
代码示例来源:origin: org.apache.ant/ant
File resolvedBaseDir = FILE_UTILS.resolveFile(helperImpl.buildFileParent,
baseDir);
helperImpl.project.setBaseDir(resolvedBaseDir);
代码示例来源:origin: org.apache.ant/ant
newProject.setBaseDir(dir);
if (savedDir != null) {
代码示例来源:origin: org.apache.ant/ant
project.setBasedir(baseDir);
} else {
project.setBaseDir(FILE_UTILS.resolveFile(context.getBuildFileParent(),
baseDir));
代码示例来源:origin: org.codehaus.mojo/antcall
public void setProjectBasedir( File basedir )
{
checkOrCreateProjectAndTarget();
antProject.setBaseDir( basedir );
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ant.ui
@Override
public void setBaseDir(File baseDir) throws BuildException {
super.setBaseDir(baseDir);
setNewProperty("basedir", getBaseDir().getPath()); //$NON-NLS-1$
}
代码示例来源:origin: org.gradle/gradle-core
@TaskAction
protected void executeAntTarget() {
File oldBaseDir = target.getProject().getBaseDir();
target.getProject().setBaseDir(baseDir);
try {
target.performTasks();
} finally {
target.getProject().setBaseDir(oldBaseDir);
}
}
代码示例来源:origin: com.github.odavid.maven.plugins/plexus-ant-factory
private void initializeProject()
{
this.project = new Project();
project.init();
project.setUserProperty( "ant.version", Main.getAntVersion() );
project.setProperty( "ant.file", script.toString() );
project.setBaseDir( basedir );
for ( Iterator it = references.entrySet().iterator(); it.hasNext(); )
{
Map.Entry entry = (Map.Entry) it.next();
String key = (String) entry.getKey();
project.addReference( key, entry.getValue() );
}
for ( Iterator it = properties.entrySet().iterator(); it.hasNext(); )
{
Map.Entry entry = (Map.Entry) it.next();
String key = (String) entry.getKey();
project.setUserProperty( key, properties.getProperty( key ) );
}
}
代码示例来源:origin: org.apache.geronimo.genesis.plugins/plugin-support
public Project getAnt() {
if (ant == null) {
ant = new Project();
ant.setBaseDir(getProject().getBasedir());
initAntLogger(ant);
ant.init();
}
return ant;
}
代码示例来源:origin: org.gosu-lang.aardvark/aardvark-core
public void printProjectHelp() {
_project.init();
_project.setBaseDir(_baseDir);
_project.log(getHelp(_gosuProgram));
}
代码示例来源:origin: org.codehaus.mojo/plugin-support
public Project getAnt() {
if (ant == null) {
ant = new Project();
ant.setBaseDir(getProject().getBasedir());
initAntLogger(ant);
ant.init();
}
return ant;
}
代码示例来源:origin: stackoverflow.com
Project p = new Project();
p.init();
p.addBuildListener( new SimpleBuildListener() );
p.setBaseDir( new File( "." ).getAbsoluteFile() );
Javac task = (Javac) p.createTask( "javac" );
task.srcdir( srcDirPath );
// Filsets can be built this way
FileSet set = new FileSet();
set.setDir( srcDirPath );
set.setIncludes( "**/*.java" );
task.addFileset( set );
代码示例来源:origin: org.codehaus.mojo/plugin-support
protected void init() throws MojoExecutionException, MojoFailureException {
super.init();
ant = new Project();
ant.setBaseDir(getProject().getBasedir());
initAntLogger(ant);
ant.init();
// Inherit properties from Maven
inheritProperties();
}
代码示例来源:origin: org.apache.geronimo.genesis.plugins/plugin-support
protected void init() throws MojoExecutionException, MojoFailureException {
super.init();
ant = new Project();
ant.setBaseDir(getProject().getBasedir());
initAntLogger(ant);
ant.init();
// Inherit properties from Maven
inheritProperties();
}
代码示例来源:origin: org.jfrog.jade.plugins.common/jade-plugin-common
/**
* Create a new Ant project from the mvnInjectable.
* This method can be overrriden if needed by sub class for fine tuning of maven 2 ant.
*
* @param injectable
* @return a new Ant project
*/
protected Project newAntProject(MvnInjectable injectable) {
Project antProject = new Project();
antProject.addBuildListener(new AntBuildListener(injectable.getLog()));
MavenProject mvnProject = injectable.getProject();
if (mvnProject == null) {
throw new IllegalArgumentException("Maven project cannot be null.");
}
antProject.setBaseDir(mvnProject.getBasedir());
antProject.init();
return antProject;
}
代码示例来源:origin: org.gradle/gradle-core
public void importBuild(Object antBuildFile, Transformer<? extends String, ? super String> taskNamer) {
File file = gradleProject.file(antBuildFile);
final File baseDir = file.getParentFile();
Set<String> existingAntTargets = new HashSet<String>(getAntProject().getTargets().keySet());
File oldBaseDir = getAntProject().getBaseDir();
getAntProject().setBaseDir(baseDir);
try {
getAntProject().setUserProperty(MagicNames.ANT_FILE, file.getAbsolutePath());
ProjectHelper.configureProject(getAntProject(), file);
} catch (Exception e) {
throw new GradleException("Could not import Ant build file '" + String.valueOf(file) + "'.", e);
} finally {
getAntProject().setBaseDir(oldBaseDir);
}
// Chuck away the implicit target. It has already been executed
getAntProject().getTargets().remove("");
// Add an adapter for each newly added target
Set<String> newAntTargets = new HashSet<String>(getAntProject().getTargets().keySet());
newAntTargets.removeAll(existingAntTargets);
for (String name : newAntTargets) {
final Target target = getAntProject().getTargets().get(name);
String taskName = taskNamer.transform(target.getName());
final AntTarget task = gradleProject.getTasks().create(taskName, AntTarget.class);
configureTask(target, task, baseDir, taskNamer);
}
}
代码示例来源:origin: pmayweg/sonar-groovy
public void analyze() {
FileSet fileSet = new FileSet();
fileSet.setDir(fileSystemBaseDir);
fileSet.add((basedir, filename, file) -> files.contains(file));
List<FileSet> fileSets = new ArrayList<>();
fileSets.add(fileSet);
Project project = new Project();
project.setBaseDir(fileSystemBaseDir);
SourceAnalyzer analyzer = new AntFileSetSourceAnalyzer(project, fileSets);
GMetricsRunner runner = new GMetricsRunner();
runner.setMetricSet(() -> GMETRICS);
runner.setSourceAnalyzer(analyzer);
ResultsNode resultNode = runner.execute();
processResults(resultNode, pathToInputFile);
}
代码示例来源:origin: org.gradle/gradle-core
public DefaultAntBuilder create() {
AntLoggingAdapter loggingAdapter = loggingAdapterFactory.create();
DefaultAntBuilder antBuilder = new DefaultAntBuilder(project, loggingAdapter);
antBuilder.getProject().setBaseDir(project.getProjectDir());
antBuilder.getProject().removeBuildListener(antBuilder.getProject().getBuildListeners().get(0));
antBuilder.getProject().addBuildListener(loggingAdapter);
stoppable.add(antBuilder);
return antBuilder;
}
代码示例来源:origin: wala/WALA
final File projectDir = Files.createTempDirectory("wala-test").toFile();
projectDir.deleteOnExit();
p.setBaseDir(projectDir);
p.init();
p.fireBuildStarted();
代码示例来源:origin: wvengen/proguard-maven-plugin
antProject.setBaseDir(mojo.mavenProject.getBasedir());
内容来源于网络,如有侵权,请联系作者删除!