Generator-jhipster: v4.11.0 : Building a production War with Maven fails for microservices

Created on 26 Nov 2017  路  23Comments  路  Source: jhipster/generator-jhipster

Overview of the issue

mvnw package -Pprod,swagger,zipkin

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.6:war (default-war) on project psi: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [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/MojoExecutionException
##### **Motivation for or Use Case** ##### **Reproduce the error** ##### **Related issues** ##### **Suggest a Fix** ##### **JHipster Version(s)**
[email protected] F:\jhipster\anjia\psi
`-- [email protected]

##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.anjia.psi",
      "nativeLanguage": "zh-cn"
    },
    "jhipsterVersion": "4.11.0",
    "baseName": "psi",
    "packageName": "com.anjia.psi",
    "packageFolder": "com/anjia/psi",
    "serverPort": "8085",
    "authenticationType": "jwt",
    "hibernateCache": "hazelcast",
    "clusteredHttpSession": false,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": "eureka",
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "replaced-by-jhipster-info",
    "enableTranslation": true,
    "applicationType": "microservice",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "nativeLanguage": "zh-cn",
    "languages": [
      "zh-cn"
    ],
    "clientPackageManager": "yarn",
    "skipClient": true,
    "skipUserManagement": true
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory


JDL entity definitions





Environment and Tools

java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

git version 2.11.0.windows.3

node: v8.8.1

npm: 5.4.2

yeoman: 2.0.0

yarn: 1.3.2

os:windows 10 build 1703

Docker version 17.06.2-ce, build cec0b72

docker-compose version 1.14.0, build c7bdf9e3

Congratulations, JHipster execution is complete!

Browsers and Operating System
  • [x] Checking this box is mandatory (this is just to show you read everything)
changes

Most helpful comment

Many thanks again to @pascalgrimaud @MathieuAA @deepu105 it's incredible that you are all available on a Sunday!!! 馃憤
And also thanks to @anjia0532 for this really important bug report! 馃憤

All 23 comments

That would a huge bug. Testing right now.

I confirm the issue

This is a major issue, I have no idea what happened here.

Indeed, I confirm too :-(
The build in Travis https://travis-ci.org/jhipster/generator-jhipster/jobs/307290467 is green but the log displayed this:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.806 s
[INFO] Finished at: 2017-11-26T10:45:14+11:00
[INFO] Final Memory: 54M/578M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.6:war (default-war) on project travis-microservice-eureka: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [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/MojoExecutionException
Error: Invalid or corrupt jarfile app.war

I'll try reproducing this with the default config first, to see if there's something amiss. Then with increasingly more parts of @anjia0532's config.

I already did, it fails all the time

Except for some yarn/webpack errors (logging them to reproduce again and file an issue if need be), the default setup builds...

I think I got the fix.
Helped by: https://stackoverflow.com/questions/23114155/spring-boot-without-parent-pom-xml-cannot-generate-war-packaging

This line need to be added for microservices, for dev and prod profile:
https://github.com/jhipster/generator-jhipster/blob/master/generators/server/templates/_pom.xml#L1217

Let me few minutes to test everything and I can PR

@pascalgrimaud I think this may be it

PR done, but I have to go...

These 2 builds need to be checked, we need to look the logs, because the build will be green:

I will fix the green/red builds later

Sorry, my monolith build failed for another reason:

workspace/tmp/target/www/workbox-sw.prod

This was added by @sendilkumarn recently -> if this prevents us for doing a patch release, I'll revert this

@pascalgrimaud your PR looks like the good solution, but I really don't understand why we only find this out now! This was working fine not so long ago.

@jdubois : because we don't have parent now, after the refactoring of pom.xml: no more spring-boot-starter-parent

Looks OK
I need to check why my monolith fails (another issue!!!!)
I'll do patch release this evening

Don't hesitate to share your config + all steps, so we can try to reproduce

@sendilkumarn can you take a look at the service worker issue mentioned by @jdubois
Also is it possible add some kind of test for that?

@jdubois i have some time today so let me know how I can help here

Thanks everyone, you are all awesome!!!!
I can't work on this right now (family dinner!) but will do this evening

Since it only affects microservices and since its Sunday I guess the release can wait. No issues :)

OK this looks all good to me, I corrected my other issue.
That should be good for a release!

Many thanks again to @pascalgrimaud @MathieuAA @deepu105 it's incredible that you are all available on a Sunday!!! 馃憤
And also thanks to @anjia0532 for this really important bug report! 馃憤

I am sorry for having taken your precious time. and thanks for your job @pascalgrimaud ,it was working.

Don't be sorry for that @anjia0532 ! Thank you for reporting !
I had some time this morning between 2 coffees :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pascalgrimaud picture pascalgrimaud  路  4Comments

edvjacek picture edvjacek  路  3Comments

RizziCR picture RizziCR  路  3Comments

shivroy121 picture shivroy121  路  3Comments

ahmedeldeeb25 picture ahmedeldeeb25  路  3Comments