use of org.apache.maven.plugin.logging.Log in project jangaroo-tools by CoreMedia.
the class AbstractCompilerMojo method buildOutputFile.
private void buildOutputFile(File tempOutputDir, File outputFile) throws MojoExecutionException {
final Log log = getLog();
if (log.isDebugEnabled()) {
log.debug("Output file: " + outputFile);
}
try {
// If the directory where the output file is going to land
// doesn't exist then create it.
File outputFileDirectory = outputFile.getParentFile();
if (!outputFileDirectory.exists()) {
//noinspection ResultOfMethodCallIgnored
if (outputFileDirectory.mkdirs()) {
log.debug("created output directory " + outputFileDirectory);
}
}
@SuppressWarnings({ "unchecked" }) List<File> // resource bundle classes should always be loaded dynamically:
files = FileUtils.getFiles(tempOutputDir, "**/*.js", "**/*_properties_*.js");
// We should now have all the files we want to concat so let's do it.
Writer fos = new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8");
int tempOutputDirPathLength = tempOutputDir.getAbsolutePath().length() + 1;
for (File file : files) {
String className = file.getAbsolutePath();
className = className.substring(tempOutputDirPathLength, className.length() - ".js".length());
className = className.replace(File.separatorChar, '.');
fos.write("// class " + className + "\n");
IOUtil.copy(new FileInputStream(file), fos, "UTF-8");
fos.write('\n');
}
fos.close();
} catch (IOException e) {
throw new MojoExecutionException("could not build output file " + outputFile + ": " + e.toString(), e);
}
}
use of org.apache.maven.plugin.logging.Log in project maven-plugins by apache.
the class AbstractAssemblyMojo method isThisTheExecutionRoot.
/**
* Returns true if the current project is located at the Execution Root Directory (where mvn was launched)
*
* @return if this is the execution root
*/
boolean isThisTheExecutionRoot() {
final Log log = getLog();
log.debug("Root Folder:" + mavenSession.getExecutionRootDirectory());
log.debug("Current Folder:" + basedir);
final boolean result = mavenSession.getExecutionRootDirectory().equalsIgnoreCase(basedir.toString());
if (result) {
log.debug("This is the execution root.");
} else {
log.debug("This is NOT the execution root.");
}
return result;
}
use of org.apache.maven.plugin.logging.Log in project maven-plugins by apache.
the class AbstractJavadocMojoTest method testMJAVADOC432_DetectLinksMessages.
public void testMJAVADOC432_DetectLinksMessages() {
Log log = mock(Log.class);
when(log.isErrorEnabled()).thenReturn(true);
mojo.setLog(log);
mojo.outputDirectory = new File("target/test-classes");
// first continues after warning, next exits with warning
assertFalse(mojo.isValidJavadocLink(new File("pom.xml").getPath(), true));
assertFalse(mojo.isValidJavadocLink("file://%%", true));
assertFalse(mojo.isValidJavadocLink(new File("pom.xml").toURI().toString(), true));
verify(log, times(4)).warn(anyString());
verify(log, never()).error(anyString());
// first continues after error, next exits with error
assertFalse(mojo.isValidJavadocLink(new File("pom.xml").getPath(), false));
assertFalse(mojo.isValidJavadocLink("file://%%", false));
assertFalse(mojo.isValidJavadocLink(new File("pom.xml").toURI().toString(), false));
verify(log, times(4)).error(anyString());
// no extra warnings
verify(log, times(4)).warn(anyString());
}
use of org.apache.maven.plugin.logging.Log in project maven-plugins by apache.
the class GitHubDownloaderTestCase method testConfigureAuthenticationWithNoServer.
public void testConfigureAuthenticationWithNoServer() throws Exception {
IssueManagement issueManagement = newGitHubIssueManagement();
GitHubDownloader gitHubDownloader = newGitHubDownloader(issueManagement);
Settings settings = new Settings();
Server server = newServer("not-the-right-one");
settings.addServer(server);
SettingsDecrypter decrypter = mock(SettingsDecrypter.class);
SettingsDecryptionResult result = mock(SettingsDecryptionResult.class);
Log log = mock(Log.class);
when(result.getProblems()).thenReturn(Collections.<SettingsProblem>emptyList());
when(result.getServer()).thenReturn(server);
when(decrypter.decrypt(new DefaultSettingsDecryptionRequest(server))).thenReturn(result);
gitHubDownloader.configureAuthentication(decrypter, "github-server", settings, log);
verify(log).warn("Can't find server id [github-server] configured in githubAPIServerId.");
}
use of org.apache.maven.plugin.logging.Log in project maven-plugins by apache.
the class MinijarFilterTest method finsishedShouldProduceMessageForClassesTotalNonZero.
@Test
public void finsishedShouldProduceMessageForClassesTotalNonZero() {
ArgumentCaptor<CharSequence> logCaptor = ArgumentCaptor.forClass(CharSequence.class);
Log log = mock(Log.class);
MinijarFilter m = new MinijarFilter(1, 50, log);
m.finished();
verify(log, times(1)).info(logCaptor.capture());
assertEquals("Minimized 51 -> 1 (1%)", logCaptor.getValue());
}
Aggregations