jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.57k stars 4.02k forks source link

Plugin validation issues exist with 2 plugins #22487

Open mraible opened 1 year ago

mraible commented 1 year ago
Overview of the issue

When I create a new project with blog-oauth2.jdl (after fixing for v8), there's some warnings about Maven plugins:

[WARNING] Plugin validation issues were detected in 2 plugin(s)
[WARNING]
[WARNING]  * com.github.eirslett:frontend-maven-plugin:1.12.1
[WARNING]  * org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184
[WARNING]
[WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [BRIEF, DEFAULT, VERBOSE]
Motivation for or Use Case

It doesn't look good to have warnings from build files.

Reproduce the error
jhipster jdl blog-oauth2.jdl
# fix JDL by adding User with builtInEntity and run again

These warnings happen as part of the app creation process.

JHipster Version(s)

main branch

blog@0.0.1-SNAPSHOT /Users/mraible/Downloads/oauth
└── (empty)
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "applicationIndex": 0,
  "applicationType": "monolith",
  "authenticationType": "oauth2",
  "baseName": "blog",
  "buildTool": "maven",
  "cacheProvider": "ehcache",
  "clientFramework": "angular",
  "clientTheme": "none",
  "clientThemeVariant": "",
  "creationTimestamp": 1686436859339,
  "databaseType": "sql",
  "devDatabaseType": "h2Disk",
  "devServerPort": 4200,
  "dtoSuffix": "DTO",
  "enableGradleEnterprise": false,
  "enableHibernateCache": true,
  "enableSwaggerCodegen": false,
  "enableTranslation": true,
  "entities": [
    "Blog",
    "Post",
    "Tag"
  ],
  "entitySuffix": "",
  "jhiPrefix": "jhi",
  "jhipsterVersion": "7.10.0",
  "languages": [
    "en",
    "fr"
  ],
  "lastLiquibaseTimestamp": 1686436861000,
  "messageBroker": "no",
  "nativeLanguage": "en",
  "packageFolder": "com/jhipster/demo/blog",
  "packageName": "com.jhipster.demo.blog",
  "pages": [],
  "prodDatabaseType": "mysql",
  "reactive": false,
  "searchEngine": "no",
  "serverPort": 8080,
  "serviceDiscoveryType": "no",
  "skipCheckLengthOfIdentifier": false,
  "skipClient": false,
  "skipFakeData": false,
  "skipUserManagement": true,
  "testFrameworks": [
    "cypress"
  ],
  "websocket": "no",
  "withAdminUi": true
}
Environment and Tools

openjdk version "17.0.5" 2022-10-18 LTS OpenJDK Runtime Environment GraalVM 22.3.0 (build 17.0.5+8-LTS) OpenJDK 64-Bit Server VM GraalVM 22.3.0 (build 17.0.5+8-LTS, mixed mode, sharing)

git version 2.39.2 (Apple Git-143)

node: v18.13.0 npm: 9.6.5

Docker version 23.0.5, build bc4487a

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity Blog {
  name String required minlength(3)
  handle String required minlength(2)
}
entity Post {
  title String required
  content TextBlob required
  date Instant required
}
entity Tag {
  name String required minlength(2)
}
relationship ManyToOne {
  Blog{user(login)} to User with builtInEntity
  Post{blog(name)} to Blog
}
relationship ManyToMany {
  Post{tag(name)} to Tag{entry}
}

search Blog, Post, Tag with no
paginate Post, Tag with infinite-scroll

mraible commented 1 year ago

The warning is gone for the first plugin but still exists for Sonar. This seems to be related: https://community.sonarsource.com/t/sonar-maven-plugin-validation-warning/92444

mraible commented 1 year ago

I learned today that you can use -Dmaven.plugin.validation=VERBOSE to see what's wrong. For example:

./mvnw compile -Dmaven.plugin.validation=VERBOSE

Results in:

[WARNING]
[WARNING] Plugin validation issues were detected in 2 plugin(s)
[WARNING]
[WARNING]  * org.jacoco:jacoco-maven-plugin:0.8.10
[WARNING]   Declared at location(s):
[WARNING]    * ir.bahilla.gateway:bahilla-gateway:0.0.1-SNAPSHOT (pom.xml) @ line 390
[WARNING]   Used in module(s):
[WARNING]    * ir.bahilla.gateway:bahilla-gateway:0.0.1-SNAPSHOT (pom.xml)
[WARNING]   Plugin issue(s):
[WARNING]    * Plugin is a Maven 2.x plugin, which will be not supported in Maven 4.x
[WARNING]    * Plugin mixes multiple Maven versions: [3.0, 2.0.2]
[WARNING]    * Plugin should declare these Maven artifacts in `provided` scope: [org.apache.maven:maven-repository-metadata:3.0, org.apache.maven:maven-artifact:3.0]
[WARNING]    * Plugin depends on plexus-container-default, which is EOL
[WARNING]
[WARNING]  * org.apache.maven.plugins:maven-resources-plugin:3.3.1
[WARNING]   Declared at location(s):
[WARNING]    * ir.bahilla.gateway:bahilla-gateway:0.0.1-SNAPSHOT (pom.xml) @ line 374
[WARNING]   Used in module(s):
[WARNING]    * ir.bahilla.gateway:bahilla-gateway:0.0.1-SNAPSHOT (pom.xml)
[WARNING]   Mojo issue(s):
[WARNING]    * Mojo resources:resources (org.apache.maven.plugins.resources.ResourcesMojo)
[WARNING]      - Parameter 'resources' is read-only, must not be used in configuration
[WARNING]
[WARNING]
[WARNING] Fix reported issues by adjusting plugin configuration or by upgrading above listed plugins. If no upgrade available, please notify plugin maintainers about reported issues.
[WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [BRIEF, DEFAULT, VERBOSE]
[WARNING]
aheritier commented 1 year ago

Hi @mraible @deepu105 The resource plugin warning comes from here: https://github.com/jhipster/generator-jhipster/blob/master/generators/server/templates/pom.xml.ejs#L1392 Because you use the ID default-resources your configuration for the resource-plugin is also applied to the default resource:resource mojo attached by default to the process-resources phase. But unlike resource:copy-resources which is allowing to configure the resources parameters (as you did here: https://github.com/jhipster/generator-jhipster/blob/master/generators/server/templates/pom.xml.ejs#L1403C41-L1403C41) the resource:resource mojo doesn't allow to configure this parameter because it's input is supposed to come from project/build/resources in the pom.

Now you don't extend anymore by default the spring-boot-parent pom you can probably do something like they do without requiring an additional copy of ressources

  ...
    <build>
        <defaultGoal>spring-boot:run</defaultGoal>

        <resources>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/application*.yml</include>
                    <include>**/application*.yaml</include>
                    <include>**/application*.properties</include>
                    <include>config/*.yml</include>
                </includes>
            </resource>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
                <excludes>
                    <exclude>**/application*.yml</exclude>
                    <exclude>**/application*.yaml</exclude>
                    <exclude>**/application*.properties</exclude>
                    <exclude>config/*.yml</exclude>
                </excludes>
            </resource>
        </resources>
...
      <pluginManagement>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <configuration>
            <propertiesEncoding>${project.build.sourceEncoding}</propertiesEncoding>
            <delimiters>
              <delimiter>${resource.delimiter}</delimiter>
            </delimiters>
            <useDefaultDelimiters>false</useDefaultDelimiters>
          </configuration>
        </plugin>

HTH

mraible commented 1 year ago

Thanks for the suggestion, @aheritier! I created https://github.com/jhipster/generator-jhipster/pull/23945 to fix it.

mraible commented 1 year ago

Fixed by #23946.

aheritier commented 1 year ago

We probably didn't fix everything here @mraible

Issues about frontend and sonar plugins could be probably solved by upgrading them but I didn't look at them for now.

mraible commented 1 year ago

@aheritier I'll re-open this issue. If I run the following command:

./mvnw compile -Dmaven.plugin.validation=VERBOSE

There is a warning:

[WARNING]
[WARNING]  * org.apache.maven.plugins:maven-checkstyle-plugin:3.3.0
[WARNING]   Plugin EXTERNAL issue(s):
[WARNING]    * Plugin depends on plexus-container-default, which is EOL
github-actions[bot] commented 1 year ago

JHipster has completed the sample check .yo-rc.json: valid Entities JDL: valid Application: successfully generated Frontend check: skipped Backend check: skipped E2E check: skipped

geyuqiu commented 11 months ago

I had the same error when building project (mvn -Pprod)

upgrading to maven 3.9.6, these errors disappeared