本文整理汇总了Java中org.apache.tools.ant.BuildLogger.setMessageOutputLevel方法的典型用法代码示例。如果您正苦于以下问题:Java BuildLogger.setMessageOutputLevel方法的具体用法?Java BuildLogger.setMessageOutputLevel怎么用?Java BuildLogger.setMessageOutputLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.BuildLogger
的用法示例。
在下文中一共展示了BuildLogger.setMessageOutputLevel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createProject
import org.apache.tools.ant.BuildLogger; //导入方法依赖的package包/类
/**
* @return Factory method to create new Project instances
*/
protected static Project createProject() {
final Project project = new Project();
final ProjectHelper helper = ProjectHelper.getProjectHelper();
project.addReference(ProjectHelper.PROJECTHELPER_REFERENCE, helper);
helper.getImportStack().addElement("AntBuilder"); // import checks that stack is not empty
final BuildLogger logger = new NoBannerLogger();
logger.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_INFO);
logger.setOutputPrintStream(System.out);
logger.setErrorPrintStream(System.err);
project.addBuildListener(logger);
project.init();
project.getBaseDir();
return project;
}
示例2: createProject
import org.apache.tools.ant.BuildLogger; //导入方法依赖的package包/类
/**
* Creates and configures Ant project for Java task.
*
* @return Ant project for Java task
*/
protected Project createProject()
{
final Project result = new Project();
final ProjectHelper helper = ProjectHelper.getProjectHelper();
result.addReference( ProjectHelper.PROJECTHELPER_REFERENCE, helper );
helper.getImportStack().addElement( "AntBuilder" ); // import checks that stack is not empty
final BuildLogger logger = new NoBannerLogger();
logger.setMessageOutputLevel( Project.MSG_INFO );
logger.setOutputPrintStream( System.out );
logger.setErrorPrintStream( System.err );
result.addBuildListener( logger );
result.init();
result.setDefaultInputStream( System.in ); // for interactive commands, like "shell", needs more work!
return result;
}
示例3: createProject
import org.apache.tools.ant.BuildLogger; //导入方法依赖的package包/类
protected Project createProject()
{
final Project project = new Project();
final ProjectHelper helper = ProjectHelper.getProjectHelper();
project.addReference( ProjectHelper.PROJECTHELPER_REFERENCE, helper );
helper.getImportStack().addElement( "AntBuilder" ); // import checks that stack is not empty
final BuildLogger logger = new NoBannerLogger();
logger.setMessageOutputLevel( Project.MSG_INFO );
logger.setOutputPrintStream( System.out );
logger.setErrorPrintStream( System.err );
project.addBuildListener( logger );
project.init();
project.getBaseDir();
return project;
}
示例4: execute
import org.apache.tools.ant.BuildLogger; //导入方法依赖的package包/类
/**
* Executes this task.
*/
@SuppressWarnings("rawtypes")
public void execute() {
if (logLevel == -1) {
throw new BuildException("You must specify a log level");
}
Vector listeners = this.getProject().getBuildListeners();
for (Iterator i = listeners.iterator(); i.hasNext();) {
BuildListener listener = (BuildListener) i.next();
if (listener instanceof BuildLogger) {
BuildLogger logger = (BuildLogger) listener;
logger.setMessageOutputLevel(logLevel);
}
}
}
示例5: runProxyGenerateTask
import org.apache.tools.ant.BuildLogger; //导入方法依赖的package包/类
/**
* Run the task.
*
* @param outputDir
* the output directory.
* @param destinationPackage
* the destination package name.
* @throws IOException
*/
private void runProxyGenerateTask(final File outputDir, final String destinationPackage)
throws IOException {
final BuildLogger logger = new DefaultLogger();
logger.setMessageOutputLevel(Project.MSG_INFO);
logger.setOutputPrintStream(System.out);
logger.setErrorPrintStream(System.out);
logger.setEmacsMode(true);
final ProjectHelper ph = ProjectHelper.getProjectHelper();
final Project p = new Project();
p.addBuildListener(logger);
p.init();
p.addReference("ant.projectHelper", ph);
final URL[] urls =
((URLClassLoader) (Thread.currentThread().getContextClassLoader())).getURLs();
final StringBuffer classPath = new StringBuffer();
for (final URL url : urls) {
classPath.append(new File(url.getPath()));
classPath.append(System.getProperty("path.separator"));
}
classPath.append("src/test/resources/test-webservices.jar");
// set properties
p.setUserProperty("client.src.dir", outputDir.getAbsolutePath());
p.setUserProperty("task.classpath", classPath.toString());
if (destinationPackage != null) {
p.setUserProperty("destinationPackage", destinationPackage);
}
ph.parse(p, new File("src/test/resources/restProxyGenBuild.xml"));
p.executeTarget("restProxyGen");
// ensure all files are generated
final Set<String> expectedFiles =
new HashSet<>(FileUtils.readLines(new File(
"src/test/resources/test-weservices-files.txt")));
final File packageDir =
new File(outputDir, destinationPackage.replaceAll("\\.", File.separator));
final Set<String> actualFiles = new HashSet<String>();
for (final File file : packageDir.listFiles()) {
if (file.isFile()) {
actualFiles.add(file.getName());
}
}
assertEquals(expectedFiles, actualFiles);
}