question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jib-maven-plugin fails if maven-war-plugin "warName" property is set

See original GitHub issue

Environment:

  • Jib version: 1.8.0, 1.7.0
  • Build tool: Maven 3.6.3
  • OS: Fedora / Windows

Description of the issue: Between 1.6.1 and 1.7.0, the behaviour of the jib-maven-plugin changed and no longer works if the WAR name is not according to the default (artifactID-version.war), but changed using the “warName” property of the maven-war-plugin.

Expected behavior: Upgrading the jib-plugin from 1.6.1 to 1.7.0 does not change the result of the build.

Steps to reproduce: I created a small repository that you can clone: https://github.com/padyx/jib-test-repository

Working configuration (initial repository state):

  1. Alter the pom.xml File in helloworld.ui.html.app.war and change the target image to a location you can push to.
  2. Execute the build as follows: mvn -Djib.to.auth.username=xxxxx -Djib.to.auth.password=xxxxx -DskipTests -P docker clean package (Success)

Error if upgrading:

  1. Change the jib-maven-plugin Version to 1.7.0 (or 1.8.0) in the helloworld/pom.xml File.
  2. Rerun the build with the command above.

jib-maven-plugin Configuration:

<!-- From parent module (build / pluginManagement) -->
<plugin>
  <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>1.7.0</version>
    <executions>
      <execution>
      <phase>package</phase>
      <goals>
        <goal>build</goal>
      </goals>
    </execution>
  </executions>
</plugin>

<!-- From build in actual module-->
<plugin>
  <groupId>com.google.cloud.tools</groupId>
  <artifactId>jib-maven-plugin</artifactId>
  <configuration>
    <from>
      <image>tomcat:9-jdk11</image>
    </from>
    <to>
      <image>padyx/testimage</image>
    </to>
  </configuration>
</plugin>

Log output: [ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:1.7.0:build (default) on project helloworld.ui.html.app.war: Obtaining project build output files failed; make sure you have compiled your project before trying to build the image. (Did you accidentally run "mvn clean jib:build" instead of "mvn clean compile jib:build"?): /home/chakotay/eclipse-workspace/helloworld/helloworld.ui.html.app.war/target/org.eclipse.scout.apps.helloworld.ui.html.war -> [Help 1]

Additional information The configuration for the war name is: (helloworld.ui.html.app.war POM File)

<plugin>
  <artifactId>maven-war-plugin</artifactId>
  <configuration>
    <warName>uihtml</warName>
  </configuration>
</plugin>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
TadCordlecommented, Jan 29, 2020

@padyx 2.0.0 has been released with this fix!

1reaction
padyxcommented, Jan 3, 2020

Awesome, thank you! 😻 I tried this out locally by building 1.8.1-SNAPSHOT and I can confirm it works now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

maven-war-plugin ignores user property war.warName
The problem is simply that you mistaken property cause user property is meant to be used usually from command like this: mvn -Dwar....
Read more >
Usage - Apache Maven WAR Plugin
There are 4 ways to use the WAR Plugin: using the package phase with the project package type as war; invocation of the...
Read more >
Failed to execute goal org.apache.maven.plugins:maven-war
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project MavenSandbox: Error assembling ...
Read more >
M2E-WTP FAQ - Eclipsepedia
By default, m2e-wtp resolves the context root of a standalone web application from the <warName> value defined in the maven-war-plugin ...
Read more >
Maven - webxml attribute is required - Mkyong.com
Maven package a web application and hits the following error message : ... declares the following maven-war-plugin plugin, and set the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found