Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource copy in multi-module does not work #838

Closed
1 of 3 tasks
jjoslet opened this issue May 10, 2024 · 2 comments Β· Fixed by #841
Closed
1 of 3 tasks

Resource copy in multi-module does not work #838

jjoslet opened this issue May 10, 2024 · 2 comments Β· Fixed by #841

Comments

@jjoslet
Copy link

jjoslet commented May 10, 2024

What is this issue about?

  • Bug report πŸͺ²
  • Feature request 🏎
  • Question ❓ Consider dropping it first in the Project Chat

Description

Considering the following multi-module maven project:

  • pom.xml
  • module-doc\
    • pom.xml
    • src/docs/asciidoc/
      • index.adoc
      • images/sample.png

The module-doc\pom.xml contains the plugin execution with the following resources:

<resources>
	<resource>
		<directory>src/docs/asciidoc/images/</directory>
		<targetPath>images/</targetPath>
		<includes>
			<include>*.png</include>
		</includes>
	</resource>
</resources>

The sample.png image is not copied in the output directory as expected.

Environment information

  • asciidoctor-maven-plugin version: 3.0.0
  • asciidoctorj version: 2.5.11
  • Apache Maven 3.9.3
  • Java version: 17.0.8.1
  • Windows 11
@abelsromero
Copy link
Member

abelsromero commented May 10, 2024

Thanks!

I was able to find an issue in

.filter(resource -> new File(resource.getDirectory()).exists())
.forEach(resource -> {
DirectoryScanner directoryScanner = new DirectoryScanner();
directoryScanner.setBasedir(resource.getDirectory());
. new File() takes the working directory as root, so when running from the parent module it's expecting resources to be in that parent.
We simply need to pass the project baseDir from the Mojo. I can't but laugh πŸ˜„ at those small un-noticed issues lingering for a long time. Happy to assist if you want to contribute it btw.

In the meantime, you can add it to the configuration.

   <directory>${project.basedir}/src/docs/asciidoc/images/</directory>

PS: not sure what you is the goal, but all non-AciiDoc sources are copied by default. There's no need to specify the resources bloc if you have some images.

@schastlivcev
Copy link
Contributor

Hi, I've tried to fix it in #841. Can you please see if I updated the tests correctly?

abelsromero pushed a commit that referenced this issue Jun 1, 2024
* Check if resource path absolute or relative
* Add CHANGELOG.adoc entry

closes #838
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants