问题:

打包成 jar 运行相关代码会报错:

Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file to load — asciidoctor

 

 

解决:

修改pom.xml  requiresUnpack特殊处理下 asciidoctorj 那些包

 

<build>
<finalName>*****</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<requiresUnpack>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
</dependency>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
</dependency>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-pdf</artifactId>
</dependency>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-epub3</artifactId>
</dependency>
</requiresUnpack>
</configuration>
</plugin>
</plugins>
</build>

 

参考

https://stackoverflow.com/questions/51412834/asciidoctorj-library-does-not-work-with-spring-boot-2-executable-boot-jar

https://github.com/spring-projects/spring-boot/issues/7399#issuecomment-260949950

 

发表评论

电子邮件地址不会被公开。