本文整理汇总了Java中org.apache.maven.plugin.logging.Log类的典型用法代码示例。如果您正苦于以下问题:Java Log类的具体用法?Java Log怎么用?Java Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Log类属于org.apache.maven.plugin.logging包,在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyFile
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
/**
* Does the actual copy of the file and logging.
*
* @param artifact represents the file to copy.
* @param destFile file name of destination file.
*
* @throws MojoExecutionException with a message if an
* error occurs.
*/
protected void copyFile ( File artifact, File destFile )
throws MojoExecutionException
{
Log theLog = this.getLog();
try
{
theLog.info( "Copying "
+ ( this.outputAbsoluteArtifactFilename ? artifact.getAbsolutePath() : artifact.getName() ) + " to "
+ destFile );
FileUtils.copyFile( artifact, destFile );
}
catch ( Exception e )
{
throw new MojoExecutionException( "Error copying artifact from " + artifact + " to " + destFile, e );
}
}
示例2: testLog
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
public void testLog()
{
Log log = new DependencySilentLog();
String text = new String( "Text" );
Throwable e = new RuntimeException();
log.debug( text );
log.debug( text, e );
log.debug( e );
log.info( text );
log.info( text, e );
log.info( e );
log.warn( text );
log.warn( text, e );
log.warn( e );
log.error( text );
log.error( text, e );
log.error( e );
log.isDebugEnabled();
log.isErrorEnabled();
log.isWarnEnabled();
log.isInfoEnabled();
}
示例3: removeDirectory
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
/**
* Deletes a directory and its contents.
*
* @param dir
* The base directory of the included and excluded files.
* @throws IOException
* @throws MojoExecutionException
* When a directory failed to get deleted.
*/
public static void removeDirectory( File dir )
throws IOException
{
if ( dir != null )
{
Log log = new SilentLog();
FileSetManager fileSetManager = new FileSetManager( log, false );
FileSet fs = new FileSet();
fs.setDirectory( dir.getPath() );
fs.addInclude( "**/**" );
fileSetManager.delete( fs );
}
}
示例4: sendGetCommand
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
/**
* sendGetCommand
*
* @param url
* @param log
* @return
* @throws MojoExecutionException
* @throws CheckException
*/
public Map<String, String> sendGetCommand( String url, Log log )
throws CheckException
{
Map<String, String> response = new HashMap<String, String>();
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpget = new HttpGet( url );
try
{
CloseableHttpResponse httpResponse = httpclient.execute( httpget, localContext );
ResponseHandler<String> handler = new ResponseErrorHandler();
String body = handler.handleResponse( httpResponse );
response.put( "body", body );
httpResponse.close();
}
catch ( Exception e )
{
log.warn( "GET request failed!" );
throw new CheckException( "Send GET to server failed!", e );
}
return response;
}
示例5: execute
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
@Override
public void execute() throws MojoExecutionException {
final Log log = getLog();
if (skipZip) {
log.info("skipZip is true. Skipping zipping.");
return;
}
try {
for (ZipTarget zipTarget : zipTargets) {
ZipUtil.writeZip(zipTarget.getZipFiles(), zipTarget.getZipDest(), buildPath);
log.info("Created zip:" + zipTarget.getZipDest());
}
} catch (IOException e) {
throw new MojoExecutionException("IO Exception encountered: ", e);
}
}
示例6: execute
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
public static void execute(ContainerOrchestrationRuntime runtime, Carnotzet carnotzet, Log log)
throws MojoExecutionException, MojoFailureException {
try {
IpPlaceholderResolver ipPlaceholderResolver = new IpPlaceholderResolver(runtime);
WelcomePageGenerator generator = new WelcomePageGenerator(Arrays.asList(ipPlaceholderResolver));
Path moduleResources = carnotzet.getResourcesFolder().resolve("expanded-jars");
Path welcomePagePath = carnotzet.getResourcesFolder().resolve("welcome.html");
generator.buildWelcomeHtmlFile(moduleResources, welcomePagePath);
new ProcessBuilder("xdg-open", "file://" + welcomePagePath).start();
log.info("********************************************************");
log.info("* *");
log.info("* The WELCOME page was opened in your default browser *");
log.info("* *");
log.info("********************************************************");
}
catch (IOException e) {
throw new MojoExecutionException("Cannot start browser:" + e, e);
}
}
示例7: execute
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
public static void execute(ContainerOrchestrationRuntime runtime, Log log) {
List<Container> containers = runtime.getContainers();
if (containers.isEmpty()) {
log.info("There doesn't seem to be any containers created yet for this carnotzet, please make sure the carnotzet is started");
return;
}
log.info("");
log.info(String.format("%-25s", "APPLICATION") + " IP ADDRESS");
log.info("");
for (Container container : containers) {
log.info(String.format("%-25s", container.getServiceName()) + " : "
+ (container.getIp() == null ? "No address, is container started ?"
: container.getIp() + " (" + container.getServiceName() + ".docker)"));
}
log.info("");
}
示例8: promptForContainer
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
/**
* Lists services and prompts the user to choose one
*/
private static Container promptForContainer(List<Container> containers, Prompter prompter, Log log) throws MojoExecutionException {
log.info("");
log.info("SERVICE");
log.info("");
Map<Integer, Container> options = new HashMap<>();
Integer i = 1;
for (Container container : containers) {
options.put(i, container);
log.info(String.format("%2d", i) + " : " + container.getServiceName());
i++;
}
log.info("");
try {
String prompt = prompter.prompt("Choose a service");
return options.get(Integer.valueOf(prompt));
}
catch (PrompterException e) {
throw new MojoExecutionException("Prompter error" + e.getMessage());
}
}
示例9: MinijarFilter
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
/**
* @param project {@link MavenProject}
* @param log {@link Log}
* @param simpleFilters {@link SimpleFilter}
* @throws IOException in case of errors.
* @since 1.6
*/
public MinijarFilter( MavenProject project, Log log, List<SimpleFilter> simpleFilters )
throws IOException
{
this.log = log;
Clazzpath cp = new Clazzpath();
ClazzpathUnit artifactUnit =
cp.addClazzpathUnit( new FileInputStream( project.getArtifact().getFile() ), project.toString() );
for ( Artifact dependency : project.getArtifacts() )
{
addDependencyToClasspath( cp, dependency );
}
removable = cp.getClazzes();
removePackages( artifactUnit );
removable.removeAll( artifactUnit.getClazzes() );
removable.removeAll( artifactUnit.getTransitiveDependencies() );
removeSpecificallyIncludedClasses( project, simpleFilters == null ? Collections.<SimpleFilter>emptyList()
: simpleFilters );
}
示例10: uploadConfig
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
/**
* Upload config to ZK
*
* @param log maven log
* @throws MojoExecutionException exception
*/
public synchronized void uploadConfig(Log log) throws MojoExecutionException {
try (SolrZkClient zkClient = new SolrZkClient(solrCloud.getZkServer().getZkAddress(chroot), TIMEOUT, TIMEOUT, null)) {
ZkConfigManager manager = new ZkConfigManager(zkClient);
if(manager.configExists(configName)) {
throw new MojoExecutionException("Config " + configName + " already exists on ZK");
}
log.debug("about to upload config from " + confDir + " to " + configName);
manager.uploadConfigDir(confDir, configName);
log.debug("Config uploaded");
}
catch (IOException e) {
throw new MojoExecutionException("Can't upload solr config in ZK " + configName, e);
}
}
示例11: buildDockerInfoJar
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
@Nonnull
protected File buildDockerInfoJar(@Nonnull Log log) throws MojoExecutionException {
final File jarFile = getJarFile(buildDirectory, finalName, classifier);
final MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver(jarArchiver);
archiver.setOutputFile(jarFile);
archive.setForced(forceCreation);
if (dockerInfoDirectory.exists()) {
final String prefix = getMetaSubdir();
archiver.getArchiver().addDirectory(dockerInfoDirectory, prefix);
} else {
log.warn("Docker info directory not created - Docker info JAR will be empty");
}
try {
archiver.createArchive(session, project, archive);
} catch (Exception e) {
throw new MojoExecutionException("Could not build Docker info JAR", e);
}
return jarFile;
}
示例12: createZipFile
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
/**
* Creates a zip fie from the given source directory and output zip file name
*/
public static void createZipFile(Log log, File sourceDir, File outputZipFile) throws IOException {
outputZipFile.getParentFile().mkdirs();
OutputStream os = new FileOutputStream(outputZipFile);
ZipOutputStream zos = new ZipOutputStream(os);
try {
//zos.setLevel(Deflater.DEFAULT_COMPRESSION);
//zos.setLevel(Deflater.NO_COMPRESSION);
String path = "";
FileFilter filter = null;
zipDirectory(log, sourceDir, zos, path, filter);
} finally {
try {
zos.close();
} catch (Exception e) {
}
}
}
示例13: MavenEnvironment
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
public MavenEnvironment(MavenSession aMavenSession, BuildPluginManager aBuildPluginManager, Log aLog,
DependencyTreeBuilder aDependencyTreeBuilder, ArtifactRepository aLocalRepository,
SecDispatcher aSecurityDispatcher, MavenProjectBuilder aProjectBuilder,
LifecycleExecutor aLifecycleExecutor, ArtifactFactory aArtifactFactory,
ArtifactMetadataSource aArtifactMetadataSource, ArtifactCollector aArtifactCollector, RuntimeInformation aRuntimeInformation,
MojoExecution aExecution) {
mavenSession = aMavenSession;
buildPluginManager = aBuildPluginManager;
log = aLog;
dependencyTreeBuilder = aDependencyTreeBuilder;
localRepository = aLocalRepository;
securityDispatcher = aSecurityDispatcher;
projectBuilder = aProjectBuilder;
lifecycleExecutor = aLifecycleExecutor;
artifactFactory = aArtifactFactory;
artifactMetadataSource = aArtifactMetadataSource;
artifactCollector = aArtifactCollector;
runtimeInformation = aRuntimeInformation;
mojoExecution = aExecution;
}
示例14: scanDirectory
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
private void scanDirectory(File directory, BufferedWriter writer) throws IOException {
if (!directory.exists())
return;
final Log log = getLog();
log.info("scanning source directory '" + directory.getAbsolutePath() + "'");
DirectoryScanner scanner = new DirectoryScanner();
scanner.setIncludes(includes);
scanner.setExcludes(excludes);
scanner.setBasedir(directory);
scanner.scan();
for (String fileName : scanner.getIncludedFiles()) {
writer.write(fileName);
writer.newLine();
}
}
示例15: processCVSRequisites
import org.apache.maven.plugin.logging.Log; //导入依赖的package包/类
@Override
public boolean processCVSRequisites(
@Nonnull final Log logger,
@Nullable final ProxySettings proxy,
@Nullable final String customCommand,
@Nonnull final File cvsFolder,
@Nullable final String branchId,
@Nullable final String tagId,
@Nullable final String revisionId
) {
boolean noError = true;
if (branchId != null) {
noError &= upToBranch(logger, proxy, customCommand, cvsFolder, branchId);
}
if (noError && tagId != null) {
noError &= upToTag(logger, proxy, customCommand, cvsFolder, tagId);
}
if (noError && revisionId != null) {
noError &= upToRevision(logger, proxy, customCommand, cvsFolder, revisionId);
}
return noError;
}