You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Alan Czajkowski (Jira)" <ji...@apache.org> on 2020/07/15 02:03:00 UTC
[jira] [Commented] (MRESOURCES-260) copy-resources goal copies
directories, but not files
[ https://issues.apache.org/jira/browse/MRESOURCES-260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17157813#comment-17157813 ]
Alan Czajkowski commented on MRESOURCES-260:
--------------------------------------------
it looks like this is an issue with how Spring Boot packages the WAR file, as demonstrated here:
{code}
...
[INFO] --- maven-resources-plugin:3.1.0:copy-resources (copy-javascript-build-output-to-webapp) @ java-microservice-example-service-www ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 18 resources
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:exec (view-files-before) @ java-microservice-example-service-www ---
total 88
drwxr-xr-x 11 alan staff 352 14 Jul 19:57 ./
drwxr-xr-x 3 alan staff 96 14 Jul 19:57 ../
-rw-r--r-- 1 alan staff 1112 14 Jul 19:57 asset-manifest.json
-rw-r--r-- 1 alan staff 2242 14 Jul 19:57 index.html
-rw-r--r-- 1 alan staff 5347 14 Jul 19:57 logo192.png
-rw-r--r-- 1 alan staff 9664 14 Jul 19:57 logo512.png
-rw-r--r-- 1 alan staff 492 14 Jul 19:57 manifest.json
-rw-r--r-- 1 alan staff 770 14 Jul 19:57 precache-manifest.18b7ba6908b71f1052abd37d218b6bd4.js
-rw-r--r-- 1 alan staff 67 14 Jul 19:57 robots.txt
-rw-r--r-- 1 alan staff 1183 14 Jul 19:57 service-worker.js
drwxr-xr-x 5 alan staff 160 14 Jul 19:57 static/
[INFO]
[INFO] --- maven-war-plugin:3.3.0:war (default-war) @ java-microservice-example-service-www ---
[INFO] Packaging webapp
[INFO] Assembling webapp [java-microservice-example-service-www] in [/Users/alan/dev/java-microservice-example/service/www/target/java-microservice-example-service-www-1.0.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/Users/alan/dev/java-microservice-example/service/www/src/main/webapp]
[INFO] Building war: /Users/alan/dev/java-microservice-example/service/www/target/java-microservice-example-service-www-1.0.0-SNAPSHOT.war
[INFO]
[INFO] --- build-helper-maven-plugin:3.2.0:remove-project-artifact (remove-old-installers) @ java-microservice-example-service-www ---
[INFO] /Users/alan/.m2/repository/com/openease/java-microservice-example-service-www/1.0.0-SNAPSHOT removed.
[INFO]
[INFO] --- spring-boot-maven-plugin:2.3.1.RELEASE:repackage (repackage) @ java-microservice-example-service-www ---
[INFO] Attaching repackaged archive /Users/alan/dev/java-microservice-example/service/www/target/java-microservice-example-service-www-1.0.0-SNAPSHOT-exec.war with classifier exec
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:exec (view-files-after) @ java-microservice-example-service-www ---
total 0
drwxr-xr-x 3 alan staff 96 14 Jul 19:57 ./
drwxr-xr-x 12 alan staff 384 14 Jul 19:57 ../
drwxr-xr-x 5 alan staff 160 14 Jul 19:57 static/
...
{code}
please close this issue
> copy-resources goal copies directories, but not files
> -----------------------------------------------------
>
> Key: MRESOURCES-260
> URL: https://issues.apache.org/jira/browse/MRESOURCES-260
> Project: Maven Resources Plugin
> Issue Type: Bug
> Components: copy
> Affects Versions: 3.1.0
> Environment: Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
> Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
> Java version: 11.0.7, vendor: Amazon.com Inc., runtime: /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home
> Default locale: en_CA, platform encoding: UTF-8
> OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"
> Reporter: Alan Czajkowski
> Priority: Major
>
> h2. Background
> the sample application source code can be found here:
> https://gitlab.com/openease/java-microservice-example
> this is a peculiar bug that is confusing me because the functionality works sometimes, but not always
> my machine:
> {code:bash}
> $ mvn -v
> Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
> Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
> Java version: 11.0.7, vendor: Amazon.com Inc., runtime: /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home
> Default locale: en_CA, platform encoding: UTF-8
> OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"
> {code}
> The project, mentioned above, is a multi-module project that does a lot of things. One of the modules builds a Spring Boot WAR bundled _together_ with a NPM application:
> [https://gitlab.com/openease/java-microservice-example/-/blob/master/service/www/pom.xml]
> the contents of the NPM build output is copied into the WAR package with the following execution:
> {code:xml}
> <execution>
> <id>copy-javascript-build-output-to-webapp</id>
> <phase>prepare-package</phase>
> <goals>
> <goal>copy-resources</goal>
> </goals>
> <configuration>
> <resources>
> <resource>
> <directory>${project.build.directory}/javascript/build</directory>
> <filtering>false</filtering>
> <includes>
> <include>**/*.css*</include>
> <include>**/*.htm*</include>
> <include>**/*.js*</include>
> <include>**/*.png*</include>
> <include>**/*.svg*</include>
> <include>**/*.txt*</include>
> </includes>
> </resource>
> </resources>
> <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes/public</outputDirectory>
> </configuration>
> </execution>
> {code}
> h2. Problem
> This execution works fine when you run:
> {code:bash}
> $ cd service/www/
> $ mvn clean prepare-package
> {code}
> it copies over all of the NPM build output contents (directories and files)
> but this execution fails when you run:
> {code:bash}
> $ cd service/www/
> $ mvn clean install
> {code}
> it copies over only the directory structure, but no files:
> {code}
> target/
> java-microservice-example-service-www-1.0.0-SNAPSHOT/
> WEB-INF/
> classes/
> public/ (no files)
> static/
> css/ (no files)
> js/ (no files)
> media/ (no files)
> {code}
> I believe the other executions defined in the {{pom.xml}} don't seem to have a problem, just this one ...
--
This message was sent by Atlassian Jira
(v8.3.4#803005)