0

I am using the frontend-maven-plugin to run npm commands during the build process. The npm commands run fine, but the build fails when trying to copy resources:

[DEBUG] file semver has a filtered file extension
[DEBUG] Using 'UTF-8' encoding to copy filtered resource 'semver'.
[DEBUG] copy /[...]/src/main/resources/emails/node_modules/normalize-package-data/node_modules/.bin/semver to /[...]/target/classes/emails/node_modules/normalize-package-data/node_modules/.bin/semver
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15.066 s
[INFO] Finished at: 2021-05-17T11:33:04+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project [...]: /[...]/target/classes/emails/node_modules/normalize-package-data/node_modules/.bin/semver -> [Help 1]
[...]
Caused by: java.nio.file.NoSuchFileException: /[...]/target/classes/emails/node_modules/normalize-package-data/node_modules/.bin/semver

However, the file does exist.

~/[...]/target/classes/emails/node_modules/normalize-package-data/node_modules/.bin $ ls -@l                                                                 
total 0
lrwxr-xr-x  1 [...]  [...]  20 17 May 11:33 semver -> ../semver/bin/semver

What can I do to stop this happening, given that the plugin otherwise appears to be working as intended?

SelketDaly
  • 539
  • 1
  • 5
  • 20

1 Answers1

0

Assuming that /node_modules/ folder has nothing to deal with generated /target/ folder, you can try to exclude it from resource processing in pom.xml (more about resource tag in pom):

<build>
  ...
  <resources>
    <resource>
      <directory>src/main/resources</directory>
      <excludes>
        <exclude>**/node_modules/**</exclude>
      </excludes>
    </resource>
  </resources>
  ...
</build>