Skip to content

Commit bf8c403

Browse files
author
Igor Fedorenko
committed
Funnel file-specific error/warning messages to plexus logger
git-svn-id: file:///opt/svn/repositories/sonatype.org/spice/trunk/plexus-build-api@1850 5751e0cb-dcb7-432f-92e2-260806df54be
1 parent c7da71e commit bf8c403

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ See the Apache License Version 2.0 for the specific language governing permissio
1616
<parent>
1717
<groupId>org.sonatype.spice</groupId>
1818
<artifactId>spice-parent</artifactId>
19-
<version>10</version>
19+
<version>14</version>
2020
</parent>
2121
<groupId>org.sonatype.plexus</groupId>
2222
<artifactId>plexus-build-api</artifactId>
@@ -28,6 +28,12 @@ See the Apache License Version 2.0 for the specific language governing permissio
2828
<artifactId>plexus-utils</artifactId>
2929
<version>1.5.8</version>
3030
</dependency>
31+
<dependency>
32+
<groupId>org.codehaus.plexus</groupId>
33+
<artifactId>plexus-container-default</artifactId>
34+
<version>1.0-alpha-9</version>
35+
<scope>provided</scope>
36+
</dependency>
3137
</dependencies>
3238

3339
<build>

src/main/java/org/sonatype/plexus/build/incremental/DefaultBuildContext.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.io.OutputStream;
2020
import java.util.List;
2121

22+
import org.codehaus.plexus.logging.AbstractLogEnabled;
2223
import org.codehaus.plexus.util.DirectoryScanner;
2324
import org.codehaus.plexus.util.Scanner;
2425

@@ -35,7 +36,7 @@
3536
* @plexus.component role="org.sonatype.plexus.build.incremental.BuildContext"
3637
* role-hint="default"
3738
*/
38-
public class DefaultBuildContext implements BuildContext {
39+
public class DefaultBuildContext extends AbstractLogEnabled implements BuildContext {
3940

4041
public boolean hasDelta(String relpath) {
4142
return true;
@@ -83,9 +84,18 @@ public void setValue(String key, Object value) {
8384
}
8485

8586
public void addWarning(File file, int line, int column, String message, Throwable cause) {
87+
getLogger().warn(getMessage(file, line, column, message), cause);
88+
}
89+
90+
private String getMessage(File file, int line, int column, String message) {
91+
StringBuffer sb = new StringBuffer();
92+
sb.append(file.getAbsolutePath()).append(" [").append(line).append(':').append(column).append("]: ");
93+
sb.append(message);
94+
return sb.toString();
8695
}
8796

8897
public void addError(File file, int line, int column, String message, Throwable cause) {
98+
getLogger().error(getMessage(file, line, column, message), cause);
8999
}
90100

91101
public boolean isUptodate(File target, File source) {

0 commit comments

Comments
 (0)