nxrocks: [Bug] Nx fails to cache all the logs generated by @nxrocks/nx-spring-boot
Plugin Name
Plugin Version
4.1.0
Nx Version
13.8.1
Expected Behaviour
Running an nx-cacheable task twice should render the same logs in the terminal when using the executor @nxrocks/nx-spring-boot:*.
Actual Behaviour
Logs generated by @nxrocks/nx-spring-boot:build are not cached.
Steps to reproduce the behaviour
Using the executor @nxrocks/nx-spring-boot:build
Consider this Nx task:
"build": {
"executor": "@nxrocks/nx-spring-boot:build",
"options": {
"root": "libs/shared/data-access-java"
}
},
- Clear the nx cache:
nx clear-cache - Run the task
$ nx run shared-data-access-java:build
> nx run shared-data-access-java:build
Executing command: ./mvnw package
Warning: JAVA_HOME environment variable is not set.
plop
[INFO] Scanning for projects...
[INFO]
[INFO] -----------< org.sagebionetworks.challenge:data-access-java >-----------
[INFO] Building data-access-java 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ data-access-java ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ data-access-java ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ data-access-java ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /workspaces/challenge-registry/libs/shared/data-access-java/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) @ data-access-java ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ data-access-java ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) @ data-access-java ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.823 s
[INFO] Finished at: 2022-06-26T16:52:49Z
[INFO] ------------------------------------------------------------------------
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project shared-data-access-java (2s)
- Run the task again:
$ nx run shared-data-access-java:build
> nx run shared-data-access-java:build [existing outputs match the cache, left as is]
Executing command: ./mvnw package
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project shared-data-access-java (15ms)
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
The logs generated by the Maven wrapper have not been captured by Nx.
Building using Maven directly (without using @nxrocks/nx-spring-boot)
Consider this Nx task that builds the same project as above:
"build": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"command": "./mvnw package",
"cwd": "libs/shared/data-access-java"
}
},
- Clear the nx cache:
nx clear-cache - Run the task
$ nx run shared-data-access-java:build
> nx run shared-data-access-java:build
Warning: JAVA_HOME environment variable is not set.
plop
[INFO] Scanning for projects...
[INFO]
[INFO] -----------< org.sagebionetworks.challenge:data-access-java >-----------
[INFO] Building data-access-java 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ data-access-java ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ data-access-java ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ data-access-java ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /workspaces/challenge-registry/libs/shared/data-access-java/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) @ data-access-java ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ data-access-java ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) @ data-access-java ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.761 s
[INFO] Finished at: 2022-06-26T16:56:43Z
[INFO] ------------------------------------------------------------------------
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project shared-data-access-java (2s)
- Run the task again.
$ nx run shared-data-access-java:build
> nx run shared-data-access-java:build [existing outputs match the cache, left as is]
Warning: JAVA_HOME environment variable is not set.
plop
[INFO] Scanning for projects...
[INFO]
[INFO] -----------< org.sagebionetworks.challenge:data-access-java >-----------
[INFO] Building data-access-java 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ data-access-java ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ data-access-java ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ data-access-java ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /workspaces/challenge-registry/libs/shared/data-access-java/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) @ data-access-java ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ data-access-java ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) @ data-access-java ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.761 s
[INFO] Finished at: 2022-06-26T16:56:43Z
[INFO] ------------------------------------------------------------------------
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project shared-data-access-java (16ms)
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
This time the logs of the cached task have been properly captured by Nx.
Thanks!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (6 by maintainers)
Commits related to this issue
- chore(common): 🚀 release 1.2.2 # [@nxrocks/common-v1.2.2](https://github.com/tinesoft/nxrocks/compare/common/v1.2.1...common/v1.2.2) (2022-08-25) ### Bug Fixes * fix executor output not restored w... — committed to tinesoft/nxrocks by semantic-release-bot 2 years ago
- chore(nx-flutter): 🚀 release 4.0.2 # [@nxrocks/nx-flutter-v4.0.2](https://github.com/tinesoft/nxrocks/compare/nx-flutter/v4.0.1...nx-flutter/v4.0.2) (2022-08-25) ### Bug Fixes * fix executor outpu... — committed to tinesoft/nxrocks by semantic-release-bot 2 years ago
- chore(nx-micronaut): 🚀 release 1.0.2 # [@nxrocks/nx-micronaut-v1.0.2](https://github.com/tinesoft/nxrocks/compare/nx-micronaut/v1.0.1...nx-micronaut/v1.0.2) (2022-08-25) ### Bug Fixes * fix execut... — committed to tinesoft/nxrocks by semantic-release-bot 2 years ago
- chore(nx-quarkus): 🚀 release 3.0.2 # [@nxrocks/nx-quarkus-v3.0.2](https://github.com/tinesoft/nxrocks/compare/nx-quarkus/v3.0.1...nx-quarkus/v3.0.2) (2022-08-25) ### Bug Fixes * fix executor outpu... — committed to tinesoft/nxrocks by semantic-release-bot 2 years ago
- chore(nx-spring-boot): 🚀 release 5.0.2 # [@nxrocks/nx-spring-boot-v5.0.2](https://github.com/tinesoft/nxrocks/compare/nx-spring-boot/v5.0.1...nx-spring-boot/v5.0.2) (2022-08-25) ### Bug Fixes * fi... — committed to tinesoft/nxrocks by semantic-release-bot 2 years ago
- chore(nx-melos): 🚀 release 1.0.0 # @nxrocks/nx-melos-v1.0.0 (2023-01-10) ### Bug Fixes * wrong `@nxrocks/common` version referenced in dependent packages ([1b4b0e6](https://github.com/tinesoft/nx... — committed to tinesoft/nxrocks by semantic-release-bot a year ago
- chore(release): 🚀 release 1.0.0 [skip ci] # 1.0.0 (2023-10-08) ### Bug Fixes * add `{workspaceRoot}` prefix (from Nx `v15+`) to targets' `outputs` ([411b402](https://github.com/tinesoft/nxrocks/co... — committed to tinesoft/nxrocks by semantic-release-bot 9 months ago
- chore(release): 🚀 release 1.0.0 [skip ci] # 1.0.0 (2023-10-08) ### Bug Fixes * add `{workspaceRoot}` prefix (from Nx `v15+`) to targets' `outputs` ([411b402](https://github.com/tinesoft/nxrocks/co... — committed to tinesoft/nxrocks by semantic-release-bot 9 months ago
- chore(release): 🚀 release 1.0.0 [skip ci] # 1.0.0 (2023-10-08) ### Bug Fixes * add `{workspaceRoot}` prefix (from Nx `v15+`) to targets' `outputs` ([411b402](https://github.com/tinesoft/nxrocks/co... — committed to tinesoft/nxrocks by semantic-release-bot 9 months ago
- chore(release): 🚀 release 1.0.0 [skip ci] # 1.0.0 (2023-10-08) ### Bug Fixes * add `{workspaceRoot}` prefix (from Nx `v15+`) to targets' `outputs` ([411b402](https://github.com/tinesoft/nxrocks/co... — committed to tinesoft/nxrocks by semantic-release-bot 9 months ago
I confirm that upgrading to the latest release of the plugin fixes the issue for tasks executed with Maven and Gradle.
FYI, as I suspected, that option did the trick: