[go: nahoru, domu]

Skip to content

Commit

Permalink
Merge pull request #6 from mraible/native-blueprint
Browse files Browse the repository at this point in the history
Regenerate all apps with JHipster Native blueprint
  • Loading branch information
Matt Raible committed Mar 2, 2022
2 parents 89745c5 + e6d4c99 commit ba758df
Show file tree
Hide file tree
Showing 234 changed files with 18,594 additions and 62,216 deletions.
36 changes: 20 additions & 16 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ This repository contains five apps we (https://github.com/joshlong[@joshlong] an
- `postgres-webflux` - Angular, WebFlux, R2DBC + PostgreSQL
- `postgres-mvc` - Angular, Spring MVC, JPA + PostgreSQL
You should be able to create a JHipster monolith with OIDC, then make the following changes.
If you already have a JHipster app with OIDC, you can make the changes below to make it work with Spring Native.

====
⚡️ You can also use the https://github.com/jhipster/generator-jhipster-native[JHipster Native blueprint] to generate an app with all of these changes already included!
====

. Modify `pom.xml` to add Spring Native support:
+
Expand All @@ -38,7 +42,7 @@ You should be able to create a JHipster monolith with OIDC, then make the follow
...

<repackage.classifier/>
<spring-native.version>0.11.2</spring-native.version>
<spring-native.version>0.11.3</spring-native.version>
...

<!-- If reactive, comment out boringssl. This allows Spring Native to build the image and gets around this error:
Expand Down Expand Up @@ -96,7 +100,7 @@ You should be able to create a JHipster monolith with OIDC, then make the follow
<id>native</id>
<properties>
<repackage.classifier>exec</repackage.classifier>
<native-buildtools.version>0.9.9</native-buildtools.version>
<native-buildtools.version>0.9.10</native-buildtools.version>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -142,7 +146,16 @@ logging:
level:
root: ERROR
io.netty: ERROR
org.springframework: INFO
liquibase: ERROR
org.hibernate: ERROR
org.springframework: ERROR
com.zaxxer.hikari: ERROR
org.apache.catalina: ERROR
org.apache.tomcat: ERROR
tech.jhipster.config: ERROR
jdk.event.security: ERROR
java.net: ERROR
sun.net.www: ERROR
----

. There's an issue when using Spring WebFlux if you don't use `-DskipTests` when running `./mvnw package -Pnative`:
Expand Down Expand Up @@ -184,15 +197,9 @@ import org.springframework.nativex.hint.TypeHint;
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-native</artifactId>
<version>1.6.5</version>
<version>1.6.6</version>
</dependency>
----
And update `jhipster-dependencies` to `7.6.1-SNAPSHOT`. With v1.6.2, the following error happens:
+
----
Parameter 0 of constructor in org.springdoc.nativex.core.SpringDocHints
required a bean of type 'org.springdoc.core.SwaggerUiConfigProperties' that could not be found.
----

. Liquibase is https://github.com/spring-projects-experimental/spring-native/issues/620[not supported yet], but you can make it work by adding files from https://github.com/liquibase/liquibase/pull/2005[this pull request] to your `src/main/resources/META-INF/native-image/liquibase` directory.

Expand All @@ -207,13 +214,11 @@ required a bean of type 'org.springdoc.core.SwaggerUiConfigProperties' that coul
com.zaxxer.hikari.HikariDataSource.class,
liquibase.change.core.LoadDataColumnConfig.class,
tech.jhipster.domain.util.FixedPostgreSQL10Dialect.class,
org.hibernate.type.TextType.class
org.hibernate.type.TextType.class,
})
----

. If you're using JPA, https://docs.jboss.org/hibernate/orm/5.4/topical/html_single/bytecode/BytecodeEnhancement.html#_build_time_enhancement[configure Hibernate build-time bytecode enhancement]. Add the plugin right after the `spring-aot-maven-plugin`.
+
In `application.yml`, turn off loading of SQL so Liquibase works:
. If you're using JPA, add a type hint for `java.util.HashSet.class` and turn off loading of SQL in `application.yml` so Liquibase works:
+
[source,yaml]
----
Expand Down Expand Up @@ -264,7 +269,6 @@ public ResponseEntity<?> logout(HttpServletRequest request, @AuthenticationPrinc
== Known Issues

- `-DskipTests` is needed for both Spring MVC and WebFlux. This seems to be caused by Mockito.
- Creating a new `Post` or `Tag` in the `postgres-mvc` project doesn't work. This is a [JHipster bug](https://github.com/jhipster/generator-jhipster/issues/17794) that might be caused by the hibernate-enhance-maven-plugin.
- Several of JHipster's Administration features don't work: metrics, logs, and configuration.
- Metrics: `UnsupportedFeatureError: ThreadMXBean methods`
- Logs: `/management/loggers` returns HTML instead of JSON
Expand Down
17 changes: 14 additions & 3 deletions angular-webflux/.yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
"applicationType": "monolith",
"authenticationType": "oauth2",
"baseName": "ngflux",
"blueprints": [],
"blueprints": [
{
"name": "generator-jhipster-native",
"version": "1.0.0"
}
],
"buildTool": "maven",
"cacheProvider": "no",
"clientFramework": "angularX",
Expand All @@ -23,12 +28,17 @@
"entities": [],
"entitySuffix": "",
"jhiPrefix": "jhi",
"jhipsterVersion": "7.6.0",
"jhipsterVersion": "7.7.0",
"languages": ["en", "fr"],
"messageBroker": false,
"monorepository": true,
"nativeLanguage": "en",
"otherModules": [],
"otherModules": [
{
"name": "generator-jhipster-native",
"version": "1.0.0"
}
],
"packageName": "com.mycompany.myapp",
"pages": [],
"prodDatabaseType": "no",
Expand All @@ -41,6 +51,7 @@
"skipClient": false,
"skipCommitHook": true,
"skipFakeData": false,
"skipJhipsterDependencies": true,
"skipServer": false,
"skipUserManagement": true,
"testFrameworks": ["cypress"],
Expand Down
17 changes: 9 additions & 8 deletions angular-webflux/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ngflux

This application was generated using JHipster 7.6.0, you can find documentation and help at [https://www.jhipster.tech/documentation-archive/v7.6.0](https://www.jhipster.tech/documentation-archive/v7.6.0).
This application was generated using JHipster 7.7.0, you can find documentation and help at [https://www.jhipster.tech](https://www.jhipster.tech).

## Project Structure

Expand All @@ -15,6 +15,7 @@ In the project root, JHipster generates configuration files for tools like git,
- `.yo-resolve` (optional) - Yeoman conflict resolver
Allows to use a specific action when conflicts are found skipping prompts for files that matches a pattern. Each line should match `[pattern] [action]` with pattern been a [Minimatch](https://github.com/isaacs/minimatch#minimatch) pattern and action been one of skip (default if ommited) or force. Lines starting with `#` are considered comments and are ignored.
- `.jhipster/*.json` - JHipster entity configuration files

- `npmw` - wrapper to use locally installed npm.
JHipster installs Node and npm locally using the build tool by default. This wrapper makes sure npm is installed locally and uses it avoiding some differences different versions can cause. By using `./npmw` instead of the traditional `npm` you can configure a Node-less environment to develop or test your application.
- `/src/main/docker` - Docker configurations for the application and services that the application depends on
Expand Down Expand Up @@ -365,13 +366,13 @@ For more information refer to [Using Docker and Docker-Compose][], this page als
To configure CI for your project, run the ci-cd sub-generator (`jhipster ci-cd`), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information.

[jhipster homepage and latest documentation]: https://www.jhipster.tech
[jhipster 7.6.0 archive]: https://www.jhipster.tech/documentation-archive/v7.6.0
[using jhipster in development]: https://www.jhipster.tech/documentation-archive/v7.6.0/development/
[using docker and docker-compose]: https://www.jhipster.tech/documentation-archive/v7.6.0/docker-compose
[using jhipster in production]: https://www.jhipster.tech/documentation-archive/v7.6.0/production/
[running tests page]: https://www.jhipster.tech/documentation-archive/v7.6.0/running-tests/
[code quality page]: https://www.jhipster.tech/documentation-archive/v7.6.0/code-quality/
[setting up continuous integration]: https://www.jhipster.tech/documentation-archive/v7.6.0/setting-up-ci/
[jhipster 7.7.0 archive]: https://www.jhipster.tech
[using jhipster in development]: https://www.jhipster.tech/development/
[using docker and docker-compose]: https://www.jhipster.tech/docker-compose
[using jhipster in production]: https://www.jhipster.tech/production/
[running tests page]: https://www.jhipster.tech/running-tests/
[code quality page]: https://www.jhipster.tech/code-quality/
[setting up continuous integration]: https://www.jhipster.tech/setting-up-ci/
[node.js]: https://nodejs.org/
[npm]: https://www.npmjs.com/
[webpack]: https://webpack.github.io/
Expand Down
2 changes: 1 addition & 1 deletion angular-webflux/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"cli": {
"cache": {
"enabled": true,
"path": "./target/",
"path": "./target/angular/",
"environment": "all"
},
"packageManager": "npm"
Expand Down
19 changes: 14 additions & 5 deletions angular-webflux/npmw
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,31 @@ if [ -f "$basedir/mvnw" ]; then
PATH="$basedir/$builddir/:$PATH"
NPM_EXE="$basedir/$builddir/node_modules/npm/bin/npm-cli.js"
NODE_EXE="$basedir/$builddir/node"
else
elif [ -f "$basedir/gradlew" ]; then
bindir="$basedir/build/node/bin"
repodir="$basedir/build/node/lib/node_modules"
installCommand="$basedir/gradlew npmSetup"
else
echo "Using npm installed globally"
exec npm "$@"
fi

PATH="$bindir:$PATH"
NPM_EXE="$repodir/npm/bin/npm-cli.js"
NODE_EXE="$bindir/node"

if ! [ -x "$NPM_EXE" ]; then
if [ ! -x "$NPM_EXE" ] || [ ! -x "$NODE_EXE" ]; then
$installCommand || true
fi

if ! [ -x "$NPM_EXE" ]; then
echo "Using npm installed globally"
if [ -x "$NODE_EXE" ]; then
echo "Using node installed locally $($NODE_EXE --version)"
PATH="$bindir:$PATH"
else
NODE_EXE='node'
fi

if [ ! -x "$NPM_EXE" ]; then
echo "Local npm not found, using npm installed globally"
npm "$@"
else
echo "Using npm installed locally $($NODE_EXE $NPM_EXE --version)"
Expand Down
Loading

0 comments on commit ba758df

Please sign in to comment.