Asciidoctor maven plugin is generating index.html with no read permissions

290 Views Asked by At

Im creating an index.htm file with the asciidoctor-maven-plugin:2.2.2 and I get a build error, because the created file has no read permissions. mvn clean install

build failure stacktrace

file permissions

pom.xml

mvn clean install works on other machines. I am on a M1 Macbook Pro. I have tried to change Java version (currently using 17 Zulu) and Maven version (3.8.6), but no luck.

2

There are 2 best solutions below

0
On BEST ANSWER

asciidoctor internally uses JRuby, which in turn had related issue when running on M1: Wrong file mode/permission when opening/creating a new file [Apple Silicon, arm64, aarch64]

according to Update JNR for Apple Silicon varargs support #6985 you need to move on JRuby 9.2.21.0:

<plugin>
    <groupId>org.asciidoctor</groupId>
    <artifactId>asciidoctor-maven-plugin</artifactId>
    <dependencies>
        <dependency>
            <groupId>org.jruby</groupId>
            <artifactId>jruby</artifactId>
            <!-- <artifactId>jruby-complete</artifactId> -->
            <version>9.2.21.0</version>
        </dependency>
....
1
On

you are not including your generated files directory to the classpath. try to add this ,

<build>
    <resources>
        <resource>
            <directory>${basedir}/src/main/resources</directory>
        </resource>
        <resource>
            <directory>${project.build.directory}/classes/generated-docs/api-gateway</directory>
        </resource>
    </resources>
    ...
</build>

${basedir}/src/main/resources ==> chage it with the right directory