diff --git a/docs/modules/site-integration/pages/compatibility-matrix.adoc b/docs/modules/site-integration/pages/compatibility-matrix.adoc index 124a007f..d68ff43f 100644 --- a/docs/modules/site-integration/pages/compatibility-matrix.adoc +++ b/docs/modules/site-integration/pages/compatibility-matrix.adoc @@ -8,6 +8,11 @@ Release candidate releases are not accounted. |=== |Asciidoctor Maven Plugin | Maven Site Plugin | Supported +// TODO uncomment on release +//|v3.0.x +//|v3.1x.x ~ v4.x.x +//|Yes + |v2.2.2 |v3.1x.x |Yes diff --git a/pom.xml b/pom.xml index cf0d2cf7..6028cce0 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ 3.0.23 1.7 4.1.77.Final - 1.11.1 + 2.0.0-M2 diff --git a/src/it/maven-site-plugin/pom.xml b/src/it/maven-site-plugin/pom.xml index 3da78bca..90649e76 100644 --- a/src/it/maven-site-plugin/pom.xml +++ b/src/it/maven-site-plugin/pom.xml @@ -22,14 +22,14 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.1.2 + 3.3.0 org.apache.maven.plugins maven-site-plugin - 3.12.0 + 4.0.0-M1 ${project.basedir}/src/site/asciidoc diff --git a/src/it/maven-site-plugin/src/site/site.xml b/src/it/maven-site-plugin/src/site/site.xml index 31e63818..f9e73e29 100644 --- a/src/it/maven-site-plugin/src/site/site.xml +++ b/src/it/maven-site-plugin/src/site/site.xml @@ -1,8 +1,8 @@ + - ${reports} diff --git a/src/main/java/org/asciidoctor/maven/log/LogRecordFormatter.java b/src/main/java/org/asciidoctor/maven/log/LogRecordFormatter.java index 895fc192..8b48677b 100644 --- a/src/main/java/org/asciidoctor/maven/log/LogRecordFormatter.java +++ b/src/main/java/org/asciidoctor/maven/log/LogRecordFormatter.java @@ -53,7 +53,7 @@ private static String calculateFileRelativePath(Cursor cursor, File sourceDirect final String sourceFile = new File(cursor.getFile()).getCanonicalPath(); final String sourceDir = sourceDirectory.getCanonicalPath(); - if (sourceFile.startsWith(sourceDir)) { + if (new File(cursor.getFile()).getCanonicalFile().toPath().startsWith(sourceDir)) { return sourceFile.substring(sourceDirectory.getCanonicalPath().length() + 1); } } diff --git a/src/main/java/org/asciidoctor/maven/refresh/ResourceCopyFileAlterationListenerAdaptor.java b/src/main/java/org/asciidoctor/maven/refresh/ResourceCopyFileAlterationListenerAdaptor.java index ac2550eb..1b9fb2ee 100644 --- a/src/main/java/org/asciidoctor/maven/refresh/ResourceCopyFileAlterationListenerAdaptor.java +++ b/src/main/java/org/asciidoctor/maven/refresh/ResourceCopyFileAlterationListenerAdaptor.java @@ -120,8 +120,7 @@ private boolean containsRecursiveIncludes(Resource resource) { private boolean isSubDirectory(File parent, File file) { try { - return file.getParentFile().getCanonicalPath() - .startsWith(parent.getCanonicalPath()); + return file.getParentFile().getCanonicalFile().toPath().startsWith(parent.getCanonicalFile().toPath()); } catch (IOException e) { return false; } diff --git a/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java b/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java index 65ee0c82..a6da8571 100644 --- a/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java +++ b/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java @@ -13,13 +13,14 @@ import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.inject.Inject; import javax.inject.Provider; import java.io.File; import java.io.IOException; import java.io.Reader; -import java.util.logging.Logger; /** * This class is used by the Doxia framework @@ -33,6 +34,8 @@ @Component(role = Parser.class, hint = AsciidoctorDoxiaParser.ROLE_HINT) public class AsciidoctorDoxiaParser extends AbstractTextParser { + private Logger logger = LoggerFactory.getLogger(AsciidoctorDoxiaParser.class); + @Inject protected Provider mavenProjectProvider; @@ -52,7 +55,7 @@ public void parse(Reader reader, Sink sink, String reference) throws ParseExcept source = ""; } } catch (IOException ex) { - getLog().error("Could not read AsciiDoc source: " + ex.getLocalizedMessage()); + logger.error("Could not read AsciiDoc source: " + ex.getLocalizedMessage()); return; } @@ -79,7 +82,7 @@ public void parse(Reader reader, Sink sink, String reference) throws ParseExcept String asciidocHtml = convertAsciiDoc(asciidoctor, source, conversionConfig.getOptions()); try { // process log messages according to mojo configuration - new LogRecordsProcessors(logHandler, siteDirectory, errorMessage -> getLog().error(errorMessage)) + new LogRecordsProcessors(logHandler, siteDirectory, errorMessage -> logger.error(errorMessage)) .processLogRecords(memoryLogHandler); } catch (Exception exception) { throw new ParseException(exception.getMessage(), exception); @@ -91,10 +94,10 @@ public void parse(Reader reader, Sink sink, String reference) throws ParseExcept private MemoryLogHandler asciidoctorLoggingSetup(Asciidoctor asciidoctor, LogHandler logHandler, File siteDirectory) { final MemoryLogHandler memoryLogHandler = new MemoryLogHandler(logHandler.getOutputToConsole(), siteDirectory, - logRecord -> getLog().info(LogRecordFormatter.format(logRecord, siteDirectory))); + logRecord -> logger.info(LogRecordFormatter.format(logRecord, siteDirectory))); asciidoctor.registerLogHandler(memoryLogHandler); // disable default console output of AsciidoctorJ - Logger.getLogger("asciidoctor").setUseParentHandlers(false); + java.util.logging.Logger.getLogger("asciidoctor").setUseParentHandlers(false); return memoryLogHandler; } @@ -136,7 +139,7 @@ private void requireLibrary(Asciidoctor asciidoctor, String require) { try { asciidoctor.requireLibrary(require); } catch (Exception ex) { - getLog().error(ex.getLocalizedMessage()); + logger.error(ex.getLocalizedMessage()); } } } diff --git a/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParserModule.java b/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParserModule.java index 0317c2fa..42f0c307 100644 --- a/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParserModule.java +++ b/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParserModule.java @@ -30,6 +30,6 @@ public class AsciidoctorDoxiaParserModule extends AbstractParserModule { * Build a new instance of {@link AsciidoctorDoxiaParserModule}. */ public AsciidoctorDoxiaParserModule() { - super(SOURCE_DIRECTORY, FILE_EXTENSION, AsciidoctorDoxiaParser.ROLE_HINT); + super(SOURCE_DIRECTORY, AsciidoctorDoxiaParser.ROLE_HINT, FILE_EXTENSION); } }