本文整理汇总了Java中org.apache.maven.plugin.logging.Log.info方法的典型用法代码示例。如果您正苦于以下问题:Java Log.info方法的具体用法?Java Log.info怎么用?Java Log.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.plugin.logging.Log
的用法示例。
在下文中一共展示了Log.info方法的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: 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);
}
}
示例4: 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);
}
}
示例5: 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("");
}
示例6: 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());
}
}
示例7: execute
import org.apache.maven.plugin.logging.Log; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void execute() throws MojoExecutionException {
final Log log = getLog();
File usedTargetFile = new File(targetFile.getAbsolutePath());
log.info("creating source list file '" + usedTargetFile.getAbsolutePath() + "'");
try {
if (!usedTargetFile.getParentFile().exists() && !usedTargetFile.getParentFile().mkdirs())
throw new MojoExecutionException("cannot create targetdir: " + usedTargetFile.getParentFile().getAbsolutePath());
BufferedWriter writer = new BufferedWriter(new FileWriter(usedTargetFile));
scanDirectories(project.getCompileSourceRoots(), writer);
scanDirectories(project.getTestCompileSourceRoots(), writer);
IOUtil.close(writer);
} catch (IOException e) {
throw new MojoExecutionException("IO-Error while generating source list file '" + usedTargetFile + "'", e);
}
}
示例8: 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();
}
}
示例9: deploy
import org.apache.maven.plugin.logging.Log; //导入方法依赖的package包/类
private void deploy(File applicationFile, Log log) throws MojoExecutionException {
String url = configServerHostname + ":" + configServerPort;
log.info("Using " + url);
try {
InputStream is = new FileInputStream(applicationFile);
HttpClient client = new HttpClient(configServerHostname, configServerPort, log);
String response = client.deployApplication(is);
if (response == null) {
log.error("Unable to deploy to " + url);
System.exit(1);
}
long sessionId = getSessionIdFromResponse(response);
client.prepareApplication(sessionId);
if (activate) {
client.activateApplication(sessionId);
}
} catch (IOException e) {
throw new MojoExecutionException(e.getMessage());
}
}
示例10: install
import org.apache.maven.plugin.logging.Log; //导入方法依赖的package包/类
public boolean install(Log log) throws MojoExecutionException {
isValid(ImmutableMap.of("buildDirectory", buildDirectory, "localRepositoryDirectory", localRepositoryDirectory));
File buildPath = new File(getFile(buildDirectory).getAbsolutePath(), getArtifactName());
File buildPathSha1 = new File(getFile(buildDirectory).getAbsolutePath(), getArtifactName() + SUFFIX_SHA1);
File repositoryRootPath = new File(getFile(localRepositoryDirectory).getAbsolutePath(), getLocalPath()).getParentFile();
File repositoryPath = new File(repositoryRootPath, getArtifactName());
File repositoryPathSha1 = new File(repositoryRootPath, getArtifactName() + SUFFIX_SHA1);
try {
if (assertSha1(log, buildPath, buildPathSha1, false)) {
log.info("Installing " + buildPath + " to " + repositoryPath);
FileUtils.copyFileToDirectory(buildPath, repositoryRootPath);
FileUtils.copyFileToDirectory(buildPathSha1, repositoryRootPath);
}
} catch (Exception exception) {
throw new MojoExecutionException(
"Failed to install artifact [" + getArtifactNamespace() + "] from [" + buildPath + "] to [" + repositoryRootPath + "]",
exception);
}
return assertSha1(log, repositoryPath, repositoryPathSha1, false);
}
示例11: connect
import org.apache.maven.plugin.logging.Log; //导入方法依赖的package包/类
/**
* @param url
* @param parameters
* @param log
* @return
* @throws MojoExecutionException
*/
public Map<String, String> connect( String url, Map<String, Object> parameters, Log log )
throws MojoExecutionException
{
Map<String, String> response = new HashMap<String, String>();
CloseableHttpClient httpclient = HttpClients.createDefault();
List<NameValuePair> nvps = new ArrayList<>();
nvps.add( new BasicNameValuePair( "j_username", (String) parameters.get( "login" ) ) );
nvps.add( new BasicNameValuePair( "j_password", (String) parameters.get( "password" ) ) );
localContext = HttpClientContext.create();
localContext.setCookieStore( new BasicCookieStore() );
HttpPost httpPost = new HttpPost( url );
try
{
httpPost.setEntity( new UrlEncodedFormEntity( nvps ) );
CloseableHttpResponse httpResponse = httpclient.execute( httpPost, localContext );
ResponseHandler<String> handler = new ResponseErrorHandler();
String body = handler.handleResponse( httpResponse );
response.put( "body", body );
httpResponse.close();
isConnected = true;
log.info( "Connection successful" );
}
catch ( Exception e )
{
log.error( "Connection failed! : " + e.getMessage() );
isConnected = false;
throw new MojoExecutionException(
"Connection failed, please check your manager location or your credentials" );
}
return response;
}
示例12: execute
import org.apache.maven.plugin.logging.Log; //导入方法依赖的package包/类
@Override
public void execute() throws MojoExecutionException {
final Log log = getLog();
if (skipGenTemplate) {
log.info("skipGenTemplate is true. Skipping generate template step.");
return;
}
try {
for (DockerrunTemplate customDockerrunConfig : customDockerrunConfigs) {
if (customDockerrunConfig.getMappingArgs() == null) {
customDockerrunConfig.initializeMap();
}
Map<String, Object> mappingArgs = customDockerrunConfig.getMappingArgs();
addImageName(mappingArgs);
FileGenerator.generateUserDockerrunFile(
customDockerrunConfig.getDockerrunFilePath(),
customDockerrunConfig.getDockerrunDest(),
mappingArgs
);
log.info("Created custom Dockerrun file: " + customDockerrunConfig.getDockerrunDest());
}
} catch (Exception e) {
throw new MojoExecutionException("Failed to generate file", e);
}
}
示例13: execute
import org.apache.maven.plugin.logging.Log; //导入方法依赖的package包/类
@Override
public void execute() throws MojoExecutionException {
final Log log = getLog();
if (skipPush) {
log.info("skipPush is true. Skipping image push step.");
return;
}
if (imageName == null || imageName.isEmpty()) {
imageName = DockerImageUtil.getImageName(
imageRepository,
tagName
);
}
try {
DockerClientManagerWithAuth dockerClientManager =
new DockerClientManagerWithAuth(region, customRegistry, authPush);
if (authPush) {
dockerClientManager.pushImage(imageName);
} else {
dockerClientManager.pushImageNoAuth(imageName);
}
} catch (InvalidCredentialsException | SdkClientException e) {
throw new MojoExecutionException(
"Could not create docker client. Invalid credentials.",
e
);
}
}
示例14: execute
import org.apache.maven.plugin.logging.Log; //导入方法依赖的package包/类
@Override
public void execute() throws MojoExecutionException {
final Log log = getLog();
if (skipGenTemplate) {
log.info("skipGenTemplate is true. Skipping generate template step.");
return;
}
try {
log.info("Generating default Dockerrun.aws.json template...");
Map<String, Object> templateArgs = getTemplateArgs();
FileGenerator.generateDefaultDockerrunFile(
dockerrunDest,
templateArgs
);
} catch (Exception e) {
throw new MojoExecutionException("Failed to generate file", e);
}
}
示例15: expandProjects
import org.apache.maven.plugin.logging.Log; //导入方法依赖的package包/类
@Override
public Set<MavenProject> expandProjects ( final Collection<MavenProject> projects, final Log log, final MavenSession session )
{
try
{
final Set<MavenProject> result = new HashSet<MavenProject> ();
final Queue<MavenProject> queue = new LinkedList<MavenProject> ( projects );
while ( !queue.isEmpty () )
{
final MavenProject project = queue.poll ();
log.debug ( "Checking project: " + project );
if ( project.getFile () == null )
{
log.info ( "Skipping non-local project: " + project );
continue;
}
if ( !result.add ( project ) )
{
// if the project was already in our result, there is no need to process twice
continue;
}
// add all children to the queue
queue.addAll ( loadChildren ( project, log, session ) );
if ( hasLocalParent ( project ) )
{
// if we have a parent, add the parent as well
queue.add ( project.getParent () );
}
}
return result;
}
catch ( final Exception e )
{
throw new RuntimeException ( e );
}
}