khalilou88 / jnxplus Goto Github PK
View Code? Open in Web Editor NEWNx plugins that adds Java/Kotlin monorepo support to Nx workspace using Gradle and Maven
License: MIT License
Nx plugins that adds Java/Kotlin monorepo support to Nx workspace using Gradle and Maven
License: MIT License
I think the best idea for kotlin-platform is that the generator create three apps with shared lib at once.
We add option to skip some apps like desktop app and with the one name we create other apps name:
so if we give my-app as a name, the project names will be:
android : my-app-android
desktop : my-app-desktop
ios : my-app-ios
shared : my-app-shared
we can add an option to change the shared name to fit the use
the generator name could be : kotlin-multiplatform (simply)
nx generate application needs xmldoc. Without installing it as dev dependency it is not working.
Until now, we use gradle.properties to handle plugin and lib versions.
I believe it's nice to have gradle version catalog for that purpose as a default mechanism.
Here https://github.com/khalilou88/nx-gradle-boot-catalog, I used gradle version catalog for spring boot projects
I created an app and a library. When I make any changes to the library code and run nx server app, it is not compiling the library code changes.
I followed the sample and created my-app and my-lib. When I first ran nx build my-app it built the JAR for lib and then the WAR for my-app. After that I changed the source code in my-lib and tried to run the nx build my-app. I can see that the class files in my-lib were updated but JAR file as not update and causing the NX cached to pick old one.
To be able to add more generators, init workspace need to just add the required code.
so here we need to add preset option to init workspace. Options well be:
none
spring boot
quarus
micronaut
kotlin-multiplatform : fill gradle.properties, setting.gradle and build.gradle with required informations
When I created nx-gradle and nx-maven to use many frameworks in the same monorepo, I faced a problem to know witch framework to build or serve in the build, serve executors. I used a framework option and with conditions I know exactly which framework I am dealing with. I think this solution is not good and I recommend using the run-task
executor instead.
With run-task
executor, we provide the task to be executed and there is no magic so we don't need to debug the command, it's already set in the project.json file.
So first of all this plugin was very easy to use. Thanks..
Im seeing one issue which i think may not be supported but asking the question.
Im trying to do a setup where some java libs live in a sub folder but saw that the dependency graph doesnt pick up these projects as dependencies when listed
Steps:
- create a lib in a sub folder
> nx generate @jnxplus/nx-boot-gradle:library messages/contacts-service
- add dependency in gradle
- start `nx graph`
My sample gradle file excerpt
// build.gradle for core-api
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation project(":libs:offer-parser") // only this is shown as dependency (sometimes not)
// these are unlinked always
implementation project(":libs:messages:contacts-service")
implementation project(":libs:messages:message-draft-service")
}
workspace,json
{
"version": 2,
"projects": {
"client": "apps/client",
"client-e2e": "apps/client-e2e",
"core-api": "apps/core-api",
"messages/contacts-service": "libs/messages/contacts-service",
"messages/message-draft-service": "libs/messages/message-draft-service",
"offer-parser": "libs/offer-parser",
"ui-buttons": "libs/ui/buttons",
"ui-typography": "libs/ui/typography"
}
}
Graph when nothing is shown as linked to core-api
.
Questions:
Currently the parent pom is expected to be at the root of the workspace but this is not always desirable for the following:
We got a weird error from checkstyle which led me to investigate a bit, and I noticed that checkstyle is actually retrieved from one of your packages and it's a fairly old version:
❯ java -jar ./node_modules/@jnxplus/checkstyle/checkstyle.jar --version
Checkstyle version: 9.3
This is mostly fine (I think our issue is not necessarily related), but this should be a bit more transparent.
A few ways I can think of to improve this:
"executor": "@jnxplus/nx-boot-maven:lint",
"options": {
"linter": "checkstyle",
"version": "10.9.3"
}
}
"executor": "@jnxplus/nx-boot-maven:lint",
"options": {
"linter": "checkstyle",
"jar": "tools/jar/checkstyle.jar" // example path, relative to project root
}
}
nx generate:library with -directory flag adding directory name with backslah
Example
nx generate @jnxplus/nx-boot-maven:library testing --directory=shared\java\api-access
adds the package name as:
package com.example.shared\java\api-access.testing;
ideally it should be (removing the dash)
package com.example.shared.java.api.access.testing;
nx serve my-app
❯ nx serve my-app
> NX Running target serve for project my-app and 1 task(s) it depends on
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> nx run my-app:build [local cache]
Executor ran for Build: {}
> nx run my-app:serve
Executor ran for serve: {}
run spring-boot:run
run spring-boot:run ./mvnw spring-boot:run -pl :my-app undefined
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.foo:my-app>--------------------
[INFO] Building my-app 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.374 s
[INFO] Finished at: 2022-06-14T18:29:14+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "undefined". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Running target "my-app:serve" failed
Failed tasks:
- my-app:serve
Hint: run the command with --verbose for more details.
Hello,
I'm facing the following problem when trying to migrate my workspace to the latest nx version 14.7.6.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @nrwl/[email protected]
npm ERR! node_modules/@nrwl/devkit
npm ERR! dev @nrwl/devkit@"14.7.6" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @nrwl/devkit@"~14.5.10" from @jnxplus/[email protected]
npm ERR! node_modules/@jnxplus/nx-boot-gradle
npm ERR! dev @jnxplus/nx-boot-gradle@"^2.4.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
My npm version is 8.19.1 and my node is 16.14.1.
I suppose that if I use --legacy-peer-deps it will work, but is it ok ?
If you have any suggestions or you can make a fix bumping your peer dependencies or moving them to the dependencies section it will be great.
Doesn't serve the api
project with the greeting
lib.
yarn run v1.22.17
$ nx serve api
> nx run api:serve
Executor ran for serve: {}
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------------< de.eon:api >-----------------------------
[INFO] Building api 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.6.3:run (default-cli) > test-compile @ api >>>
[WARNING] The POM for de.eon:greeting:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.348 s
[INFO] Finished at: 2022-03-04T11:40:46+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project api: Could not resolve dependencies for project de.eon:api:jar:0.0.1-SNAPSHOT: Could not find artifact de.eon:greeting:jar:0.0.1-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Running target "api:serve" failed
Failed tasks:
- api:serve
Hint: run the command with --verbose for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Process finished with exit code 1
> NX Report complete - copy this into the issue template
Node : 16.13.1
OS : darwin x64
yarn : 1.22.17
nx : 13.8.4
@nrwl/angular : 13.8.4
@nrwl/cli : 13.8.4
@nrwl/cypress : 13.8.4
@nrwl/detox : undefined
@nrwl/devkit : 13.8.4
@nrwl/eslint-plugin-nx : 13.8.4
@nrwl/express : undefined
@nrwl/jest : 13.8.4
@nrwl/js : undefined
@nrwl/linter : 13.8.4
@nrwl/nest : undefined
@nrwl/next : undefined
@nrwl/node : undefined
@nrwl/nx-cloud : undefined
@nrwl/react : undefined
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/storybook : 13.8.4
@nrwl/tao : 13.8.4
@nrwl/web : undefined
@nrwl/workspace : 13.8.4
typescript : 4.5.5
rxjs : 7.4.0
---------------------------------------
Community plugins:
@angular/animations: 13.2.5
@angular/common: 13.2.5
@angular/compiler: 13.2.5
@angular/core: 13.2.5
@angular/forms: 13.2.5
@angular/platform-browser: 13.2.5
@angular/platform-browser-dynamic: 13.2.5
@angular/router: 13.2.5
@angular-devkit/build-angular: 13.2.5
@angular/cli: 13.2.5
@angular/compiler-cli: 13.2.5
@angular/language-service: 13.2.5
@jnxplus/nx-boot-maven: 1.3.0
Hello,
Running target "lint" using ktlint always succeeded even if there's errors.
./node_modules/@jnxplus/ktlint/ktlint "libs/my-lib/src/**/*.kt" => show errors
but
./node_modules/@jnxplus/ktlint/ktlint libs/my-lib/src/ => show no errors
The project.json
file is not mandatory, the plugins add projects without project.json
to the graph. But for more configuration, we need to create this file.
I am thinking about making this file mandatory, and raising an error if the file is messing.
For maven, we can check if project name and artifactId are the same.
We can create a project.json
for the root project in wrapper folder so users can update namedInputs
. And like this the maven/gradle root project is different from nx root project.
Create a generator to generate missing project.json
files
From the first plugin until the last added plugins, I found that we need a more generic plugin
and not a specific one based on a framework. Because in a monorepo we need more freedom to build projects and libs.
This is why I believe that the idea of many plugins was bad and today we are deprecating all gradle plugins for @jnxplus/nx-gradle
and all maven plugins for @jnxplus/nx-maven
Hello,
I have noticed that nx maven artifact caching prob has an issue.
Given I have a dependency where app-a depends on lib-b. When I run a Nx cached build the lib-b target folder will be replaced but the lib-b wont be installed to the local m2 repo. Hence if app app-a is not cached then it will fail to build as maven wont see lib-b in the local repo.
Hello,
I had to renamed the maven build task to:
"build": {
"executor": "nx:noop",
"dependsOn": ["build-maven, build-react"],
},
"build-maven": {
"executor": "@jnxplus/nx-boot-maven:build",
"dependsOn": ["^build"],
"options": {
"mvnArgs": "-Drevision=$version"
},
"outputs": ["{projectRoot}/target"]
},
The nx graph does not show dependency links between apps and libs anymore.
Would be great to fix this so the plugin can live within a polyglot repo.
Regards,
Jose
Following the instructions at https://dev.to/gridou/how-to-add-spring-boot-and-gradle-multi-project-builds-capabilities-to-your-nx-workspace-53cd and getting this error:
D:\workspaces\nximgr\nxinterfacemanager>nx generate @jnxplus/nx-boot-gradle:application interfacemgrboot
√ Which language would you like to use? · java
√ What groupId would you like to use? · imgr
√ What project version would you like to use? · 0.0.1-SNAPSHOT
√ Which packaging would you like to use? · jar
√ Which configuration format would you like to use? · .properties
**Cannot set property 'interfacemgrboot' of undefined**
Cannot find module @nx/devkit when running migrations. I ran the command "nx migrate --run-migrations" and I got this error in the @jnxplus/common/src/lib/command/index.js. I added nx/devkit to devDependencies too but no luck.
Originally posted by andreyantipov December 15, 2022
Hello! :) Would like to clarify
Is is possible to run custom gradlew tasks within plugin?
The Github Stars are not showing up for nx-boot-gradle, nx-boot-maven, nx-quarkus-gradle and nx-quarkus-maven on the Nx Plugin Registry.
To fix this, you need to add a repository.url
in the package.json
that points to this repo. i.e.
{
"repository": {
"type": "git",
"url": "https://github.com/nrwl/nx.git",
"directory": "packages/web"
}
}
Thanks,
Isaac (Nx Team)
The version of spring boot is hard coded in every app or lib that we create. That make hard the update the spring boot version.
When generating the pom.xml or updating (like when adding a new library with existing project as dependency), extra blank lines are added after each line. Can these blank lines be removed so I can try to preserve the formatting as close as possible?
Amazing tool and very easy to use. There is a problem in package names thought. Let's say I have a grouping folder e.g. backend inside the apps folder
root
|apps
| backend
If I add the project in the directory backend/newprojectname, the package name of the app takes the full path and becomes more
less unusable ie com.example.backend.newprojectname, where it should be com.example.newprojectname.
So a good implementation would be to take in consideration just the last folder of the directory, so the package name generation
would be correct, or an extra option to manually add the package name in the creation state.
Thank you again for this great plugin.
I have tried yarn install using node 18 and 20 with the following dependencies on mac and unix
{
"private": true,
"devDependencies": {
"@jnxplus/nx-maven": "0.6.4",
"@jnxplus/nx-boot-maven": "7.2.3",
"@nx/workspace": "16.5.3",
"nx": "16.5.3"
}
}
I get the following error:
error /Users/jbadeau/git/techx/node_modules/@jnxplus/nx-boot-maven: Command failed.
Exit code: 1
Command: node src/scripts/install-linters.js
Arguments:
Directory: /Users/jbadeau/git/techx/node_modules/@jnxplus/nx-boot-maven
Output:
Error: Invalid or corrupt jarfile /Users/jbadeau/git/techx/node_modules/@jnxplus/tools/linters/ktlint/ktlint
node:internal/errors:867
const err = new Error(message);
^
Error: Command failed: java -jar /Users/jbadeau/git/techx/node_modules/@jnxplus/tools/linters/ktlint/ktlint --version
Error: Invalid or corrupt jarfile /Users/jbadeau/git/techx/node_modules/@jnxplus/tools/linters/ktlint/ktlint
at checkExecSyncError (node:child_process:885:11)
at execSync (node:child_process:957:15)
at isAnotherVersion (/Users/jbadeau/git/techx/node_modules/@jnxplus/common/src/lib/utils/index.js:94:53)
at /Users/jbadeau/git/techx/node_modules/@jnxplus/common/src/lib/utils/index.js:85:18
at Generator.next (<anonymous>)
at /Users/jbadeau/git/techx/node_modules/@jnxplus/common/node_modules/tslib/tslib.js:167:75
at new Promise (<anonymous>)
at Object.__awaiter (/Users/jbadeau/git/techx/node_modules/@jnxplus/common/node_modules/tslib/tslib.js:163:16)
at getKtlintPath (/Users/jbadeau/git/techx/node_modules/@jnxplus/common/src/lib/utils/index.js:67:20) {
I have checked the dir and the jar is not downloaded. Works when the @jnxplus/nx-boot-maven plugin is removed but we use both.
I'm trying to set up an nx project with two maven apps and a maven library. How is that supposed to work with nx-boot-maven? It sets up the maven poms correctly, but in order to build an app I need to run maven from the parent pom folder. If I run it from the app folder, maven cannot find the libary dependency. Since nx-boot-maven also seems to run mvn from the app folder, it also fails.
Am I doing something wrong here? How is it supposed to work?
EDIT: I think I found the actual problem, and in that case there would be a simple fix: #61
After running nx run api:build-image
I got the error listed below. I event tried first running mvn clean install -N
and then running again nx run api:build-image
but it didn't work.
> nx run api:build-image
Executor ran for Build Image: {}
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------------< de.eon:api >-----------------------------
[INFO] Building api 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.6.3:build-image (default-cli) > package @ api >>>
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ api ---
[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.8.1:compile (default-compile) @ api ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- kotlin-maven-plugin:1.6.10:compile (compile) @ api ---
[INFO] Applied plugin: 'spring'
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ api ---
[INFO] Changes detected - recompiling the module!
[INFO]
[INFO] --- kotlin-maven-plugin:1.6.10:test-compile (test-compile) @ api ---
[INFO] Applied plugin: 'spring'
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ api ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) @ api ---
[INFO] Building jar: /Users/vladimir.drayling/dev/web/apps/eon/apps/api/target/api-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.6.3:repackage (repackage) @ api ---
[INFO] Replacing main artifact with repackaged archive
[INFO]
[INFO] <<< spring-boot-maven-plugin:2.6.3:build-image (default-cli) < package @ api <<<
[INFO]
[INFO]
[INFO] --- spring-boot-maven-plugin:2.6.3:build-image (default-cli) @ api ---
[INFO] Building image 'docker.io/library/api:0.0.1-SNAPSHOT'
[INFO]
[INFO] I/O exception (java.io.IOException) caught when processing request to {}->docker://localhost:2376: com.sun.jna.LastErrorException: [2] No such file or directory
[INFO] Retrying request to {}->docker://localhost:2376
[INFO] I/O exception (java.io.IOException) caught when processing request to {}->docker://localhost:2376: com.sun.jna.LastErrorException: [2] No such file or directory
[INFO] Retrying request to {}->docker://localhost:2376
[INFO] I/O exception (java.io.IOException) caught when processing request to {}->docker://localhost:2376: com.sun.jna.LastErrorException: [2] No such file or directory
[INFO] Retrying request to {}->docker://localhost:2376
[INFO] > Pulling builder image 'docker.io/paketobuildpacks/builder:base' 100%
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.859 s
[INFO] Finished at: 2022-03-07T13:45:47+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.6.3:build-image (default-cli) on project api: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.6.3:build-image failed: Connection to the Docker daemon at 'localhost' failed with error "[2] No such file or directory"; ensure the Docker daemon is running and accessible: com.sun.jna.LastErrorException: [2] No such file or directory -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
——————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Running target "api:build-image" failed
Failed tasks:
- api:build-image
Hint: run the command with --verbose for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The terminal process "/bin/sh '-c', 'yarn nx run api:build-image'" terminated with exit code: 1.
> NX Report complete - copy this into the issue template
Node : 16.13.1
OS : darwin x64
yarn : 1.22.17
nx : 13.8.4
@nrwl/angular : 13.8.4
@nrwl/cli : 13.8.4
@nrwl/cypress : 13.8.4
@nrwl/detox : undefined
@nrwl/devkit : 13.8.4
@nrwl/eslint-plugin-nx : 13.8.4
@nrwl/express : undefined
@nrwl/jest : 13.8.4
@nrwl/js : undefined
@nrwl/linter : 13.8.4
@nrwl/nest : undefined
@nrwl/next : undefined
@nrwl/node : undefined
@nrwl/nx-cloud : undefined
@nrwl/react : undefined
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/storybook : 13.8.4
@nrwl/tao : 13.8.4
@nrwl/web : undefined
@nrwl/workspace : 13.8.4
typescript : 4.5.5
rxjs : 7.4.0
---------------------------------------
Community plugins:
@angular/animations: 13.2.5
@angular/common: 13.2.5
@angular/compiler: 13.2.5
@angular/core: 13.2.5
@angular/forms: 13.2.5
@angular/platform-browser: 13.2.5
@angular/platform-browser-dynamic: 13.2.5
@angular/router: 13.2.5
@angular-devkit/build-angular: 13.2.5
@angular/cli: 13.2.5
@angular/compiler-cli: 13.2.5
@angular/language-service: 13.2.5
@jnxplus/nx-boot-maven: 1.4.1
{
"npmScope": "eon",
"affected": {
"defaultBase": "master"
},
"cli": {
"defaultCollection": "@nrwl/angular",
"packageManager": "yarn"
},
"implicitDependencies": {
"package.json": {
"dependencies": "*",
"devDependencies": "*"
},
".eslintrc.json": "*"
},
"tasksRunnerOptions": {
"default": {
"runner": "@nrwl/workspace/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "lint", "test", "e2e"]
}
}
},
"targetDependencies": {
"build": [
{
"target": "build",
"projects": "dependencies"
}
]
},
"generators": {
"@nrwl/angular:application": {
"style": "scss",
"linter": "eslint",
"unitTestRunner": "jest",
"e2eTestRunner": "cypress"
},
"@nrwl/angular:library": {
"linter": "eslint",
"unitTestRunner": "jest"
},
"@nrwl/angular:component": {
"style": "scss"
}
},
"defaultProject": "web-client",
"plugins": ["@jnxplus/nx-boot-maven"]
}
Add dependencies
property for application
and library
as in spring starter.
Maybe as a list with autocompletion based on starter dependencies
Trying to init a maven project in VSCode, but getting the following error:
yarn run v1.22.17
$ /Users/vladimir.drayling/dev/web/apps/eon/node_modules/.bin/nx generate @jnxplus/nx-boot-maven:init --javaVersion=17 --no-interactive --dry-run
Property 'javaVersion' does not match the schema. '17' should be a 'string'.
> NX Report complete - copy this into the issue template
Node : 16.13.1
OS : darwin x64
yarn : 1.22.17
nx : 13.8.4
@nrwl/angular : 13.8.4
@nrwl/cli : 13.8.4
@nrwl/cypress : 13.8.4
@nrwl/detox : undefined
@nrwl/devkit : 13.8.4
@nrwl/eslint-plugin-nx : 13.8.4
@nrwl/express : undefined
@nrwl/jest : 13.8.4
@nrwl/js : undefined
@nrwl/linter : 13.8.4
@nrwl/nest : undefined
@nrwl/next : undefined
@nrwl/node : undefined
@nrwl/nx-cloud : undefined
@nrwl/react : undefined
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/storybook : 13.8.4
@nrwl/tao : 13.8.4
@nrwl/web : undefined
@nrwl/workspace : 13.8.4
typescript : 4.5.5
rxjs : 7.4.0
---------------------------------------
Community plugins:
@angular/animations: 13.2.5
@angular/common: 13.2.5
@angular/compiler: 13.2.5
@angular/core: 13.2.5
@angular/forms: 13.2.5
@angular/platform-browser: 13.2.5
@angular/platform-browser-dynamic: 13.2.5
@angular/router: 13.2.5
@angular-devkit/build-angular: 13.2.5
@angular/cli: 13.2.5
@angular/compiler-cli: 13.2.5
@angular/language-service: 13.2.5
@jnxplus/nx-boot-maven: 1.3.0
Should init maven kotlin project with java version 17
First, awesome project by the way. Thanks for working on this project.
When following your maven tutorial, I noticed when doing nx build my-lib
and if the build was pulled from nx cache, the actual target folder would not be re-created. After looking at the nx documentation, it looks like you can add an outputs property to the project.json build target. So in my case, I added the following to the my-lib project.json file:
"build": {
"executor": "@jnxplus/nx-boot-maven:build",
"outputs": ["libs/my-lib/target"]
}
Now after running nx build my-lib
, and if nx decides to pull from cache, the my-lib target folder gets pulled from cache. Do you see any issue in introducing this outputs property?
Trying to do "nx migrate next" and then npm install
Got this error
npm ERR! Found: @nrwl/[email protected]
npm ERR! node_modules/@nrwl/workspace
npm ERR! dev @nrwl/workspace@"16.1.0-rc.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @nrwl/workspace@">=14.0.0" from @jnxplus/[email protected]
npm ERR! node_modules/@jnxplus/nx-boot-maven
npm ERR! dev @jnxplus/nx-boot-maven@"^5.4.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Hello,
I really appreciate this plugin.
It would be really great if you created releases
nx dep-graph
❯ NX_VERBOSE_LOGGING=true nx dep-graph
TypeError: (0 , app_root_1.fileExists) is not a function
at Object.processProjectGraph (/Users/cgalancladera/foo/node_modules/@jnxplus/nx-boot-maven/src/dep-graph/lookup-deps.js:14:39)
at /Users/cgalancladera/foo/node_modules/nx/src/project-graph/build-project-graph.js:212:38
at Generator.next (<anonymous>)
at /Users/cgalancladera/foo/node_modules/tslib/tslib.js:118:75
at new Promise (<anonymous>)
at Object.__awaiter (/Users/cgalancladera/foo/node_modules/tslib/tslib.js:114:16)
at updateProjectGraphWithPlugins (/Users/cgalancladera/foo/node_modules/nx/src/project-graph/build-project-graph.js:207:20)
at /Users/cgalancladera/foo/node_modules/nx/src/project-graph/build-project-graph.js:89:25
at Generator.next (<anonymous>)
at fulfilled (/Users/cgalancladera/foo/node_modules/tslib/tslib.js:115:62)
Failed to process the project graph with "index.js". This will error in the future!
TypeError: (0 , app_root_1.fileExists) is not a function
at Object.processProjectGraph (/Users/cgalancladera/foo/node_modules/@jnxplus/nx-boot-maven/src/dep-graph/lookup-deps.js:14:39)
at /Users/cgalancladera/foo/node_modules/nx/src/project-graph/build-project-graph.js:212:38
at Generator.next (<anonymous>)
at /Users/cgalancladera/foo/node_modules/tslib/tslib.js:118:75
at new Promise (<anonymous>)
at Object.__awaiter (/Users/cgalancladera/foo/node_modules/tslib/tslib.js:114:16)
at updateProjectGraphWithPlugins (/Users/cgalancladera/foo/node_modules/nx/src/project-graph/build-project-graph.js:207:20)
at /Users/cgalancladera/foo/node_modules/nx/src/project-graph/build-project-graph.js:89:25
at Generator.next (<anonymous>)
at fulfilled (/Users/cgalancladera/foo/node_modules/tslib/tslib.js:115:62)
Failed to process the project graph with "index.js". This will error in the future!
As a developer I want to create a workspace generator that extends jnxplus' application generator, for example, to add new dependencies to the generated pom file.
The existing generators barrel exports all the generators but the generators' entry point functions are declared without a name, which makes it impossible to import and therefore to be called from another generator.
Here is a simplified code I'm trying to create:
import { Tree } from '@nrwl/devkit';
import { ApplicationGeneratorSchema } from './schema';
import { applicationGenerator } from '@jnxplus/nx-boot-maven/generators';
async function extendedApplicationGenerator(
tree: Tree,
options: ApplicationGeneratorSchema
) {
// Create a jnxplus application
await applicaitonGeneartor(options);
// Add additional dependencies to the pom file
await addDependencies();
}
export default extendedApplicationGenerator;
We use "prettier-plugin-kotlin" to format kotlin projects but it's not working.
We need to find another solution
Hello,
Currently I don't see the parent/parent pom connected to the submodules in the nx graph even when I add a root project.json. I suppose the dependency calculation is only calculated via <dependencies/>
and does not include </parent>
. I could of course add an implicitDependencies section but this is redundant as the info is in the pom. The effect is that if I change the root pom the submodules are not built as they are not connected in the graph.
Any plans to support parent relationships in the Nx graph?
Cheers
nx-boot-maven:init
generator fails when running on an empty repo.
Reproduce steps
npx create-nx-workspace@latest name
npm install --save-dev @jnxplus/nx-boot-maven
npx nx g @jnxplus/nx-boot-maven:init
Result
> NX Cannot find .prettierrc
Nx Version: v15.9.2
jnxplus/nx-boot-maven Version: 5.1.1
When I execute the command
nx serve application-name
I would like to add some arguments, for example:
nx serve application-name --args="-Dspring-boot.run.profiles=dev"
This arguments must be concatenated to the command spring-boot:run
. For example:
./mvnw spring-boot:run -pl :application-name -Dspring-boot.run.profiles=dev
In file:
packages/nx-boot-maven/src/executors/serve/executor.ts
change
const result = runCommand(
`${getExecutable()} spring-boot:run -pl :${context.projectName}`
);
in
const result = runCommand(
`${getExecutable()} spring-boot:run -pl :${context.projectName} ${args}`
);```
I wish to add a new generator to the plugin with the name db (database for long name).
this generator accept:
Hello there,
I noticed an issue in the Nx affected graph. If I have a pom.xml at the repo root and I modify any other file (e.g. README.MD) in the root I get an affected graph of all the maven projects. In this case I have no project.json at the root.
I am using:
nx: 16.7.2
@jnxplus/nx-boot-maven: 7.3.0
Might have crept in when making the change to include parent poms as dependencies. I would be ok with the root pom being only an aggregator pom and not being part of the graph.
My root pom looks like:
<?xml version="1.0" encoding="UTF-8" ?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo.techradar</groupId>
<artifactId>workspace</artifactId>
<version>0.0.0</version>
<packaging>pom</packaging>
<modules>
<module>libs/techradar</module>
</modules>
</project>
Thoughts?
npm ERR! code 1
npm ERR! path C:\xxxxx\node_modules@jnxplus\nx-boot-maven
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node src/scripts/install-linters.js
npm ERR! node:internal/process/promises:279
npm ERR! triggerUncaughtException(err, true /* fromPromise */);
npm ERR! ^
npm ERR! AxiosError: write EPROTO 16956:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332:
npm ERR!
npm ERR! at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16) {
npm ERR! syscall: 'write',
npm ERR! code: 'EPROTO',
npm ERR! errno: -4046,
npm ERR! config: {
npm ERR! transitional: {
npm ERR! silentJSONParsing: true,
npm ERR! forcedJSONParsing: true,
npm ERR! clarifyTimeoutError: false
npm ERR! },
npm ERR! adapter: [Function: httpAdapter],
npm ERR! transformRequest: [ [Function: transformRequest] ],
npm ERR! transformResponse: [ [Function: transformResponse] ],
npm ERR! timeout: 0,
npm ERR! xsrfCookieName: 'XSRF-TOKEN',
npm ERR! xsrfHeaderName: 'X-XSRF-TOKEN',
npm ERR! maxContentLength: -1,
npm ERR! maxBodyLength: -1,
npm ERR! env: {
npm ERR! FormData: [Function: FormData] {
npm ERR! LINE_BREAK: '\r\n',
npm ERR! DEFAULT_CONTENT_TYPE: 'application/octet-stream'
npm ERR! }
npm ERR! },
npm ERR! validateStatus: [Function: validateStatus],
npm ERR! headers: {
npm ERR! Accept: 'application/json, text/plain, /',
npm ERR! 'User-Agent': 'axios/0.27.2',
npm ERR! host: 'objects.githubusercontent.com'
npm ERR! },
npm ERR! method: 'get',
npm ERR! url: 'https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.10.0/checkstyle-10.10.0-all.jar',
npm ERR! responseType: 'stream',
npm ERR! data: undefined
npm ERR! },
When we run init generator from nx-gradle we need to specify a preset of which framework we want to use, this is to keep things simple. If we want to add another framework, we need to add other properties manually.
I think is nice to have a generator to compete the properties by what messing
Hello,
it would be really cool if you could make the dependency on maven wrapper optional as most cicd tools provide maven via containers.
Hi!
I might have missed something here, apologies if so.
On serve we have the "options" flag which allows us to pass arguments to maven, e.g:
"options": {
"args": "-Dspring-boot.run.profiles=local"
}
However for build there is no options / args. This means I'm seeing 20-30 000 lines of "Downloading" logs in github actions, and I would be ecstatic if I somehow could get rid of those :)
Hello,
given 2 projects
when I run nx run-many --target=serve --projects=project1,project2
then only one project is served
I expect the two project will be served
prettier-plugin-java
and @prettier/plugin-xml
are no longer deps. Init should add this libs to the root package.json
Currently i am using the mvn wrapper. But the problem is that in Azure I use a different corporate proxy and in local a different one. So adding these in .mvn/jvm.config is problematic. Is there a way I can use the Azure Maven@3 task to make mvn available for the nx?
Hi Khalil,
I am one of the leads on the Nx team.
Firstly, I would like to thank you for maintaining the jnxplus plugins for Java. It is awesome to see the community take the initiative on adding support for other languages to Nx. It takes a lot of time and effort.
The Nx team has been utilizing Java, Kotlin, and Gradle more and more for different things such as:
As such, we want to introduce a first party Nx plugins for Gradle, Kotlin, Java and maybe more technologies in the Java ecosystem down the line. We know that this will possibly overlap with your plans. We would be happy for you to contribute to the first party plugin as we start developing it. Our initial plans are to focus on supporting Gradle but will probably expand in the future.
I think there are plenty of areas where the first party Nx Plugins and jnxplus are not likely to overlap anytime soon such as Flutter, Melos, Micronaut, Quarkus, etc. If there does end up becoming overlap in support, I think having alternatives is a good thing so you could continue to develop those areas. Or you could choose to stop supporting those areas in favor of the first party plugin so that you can focus on other areas.
Do you have any questions or concerns?
Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.