{"record":{"id":"2201b2ddbd67fb04","repo":"GoogleContainerTools/jib","slug":"mainclass-extraclasspath-jvmflags-and-expandcla","errorCode":null,"errorMessage":"mainClass, extraClasspath, jvmFlags, and expandClasspathDependencies are ignored for WAR projects","messagePattern":"mainClass, extraClasspath, jvmFlags, and expandClasspathDependencies are ignored for WAR projects","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java","lineNumber":623,"sourceCode":"      projectProperties.log(\n          LogEvent.info(\n              \"mainClass, extraClasspath, jvmFlags, and expandClasspathDependencies are ignored \"\n                  + \"when entrypoint is specified\"));\n    }\n\n    if (projectProperties.isWarProject()) {\n      if (entrypointDefined) {\n        return rawEntrypoint.get().size() == 1 && \"INHERIT\".equals(rawEntrypoint.get().get(0))\n            ? null\n            : rawEntrypoint.get();\n      }\n\n      if (rawConfiguration.getMainClass().isPresent()\n          || !rawConfiguration.getJvmFlags().isEmpty()\n          || !rawExtraClasspath.isEmpty()\n          || rawConfiguration.getExpandClasspathDependencies()) {\n        projectProperties.log(\n            LogEvent.warn(\n                \"mainClass, extraClasspath, jvmFlags, and expandClasspathDependencies are ignored \"\n                    + \"for WAR projects\"));\n      }\n      return rawConfiguration.getFromImage().isPresent()\n          ? null // Inherit if a custom base image.\n          : Arrays.asList(\"java\", \"-jar\", \"/usr/local/jetty/start.jar\", \"--module=ee10-deploy\");\n    }\n\n    List<String> classpath = new ArrayList<>(rawExtraClasspath);\n    AbsoluteUnixPath appRoot = getAppRootChecked(rawConfiguration, projectProperties);\n    ContainerizingMode mode = getContainerizingModeChecked(rawConfiguration, projectProperties);\n    switch (mode) {\n      case EXPLODED:\n        classpath.add(appRoot.resolve(\"resources\").toString());\n        classpath.add(appRoot.resolve(\"classes\").toString());\n        break;\n      case PACKAGED:\n        classpath.add(appRoot.resolve(\"classpath/*\").toString());","sourceCodeStart":605,"sourceCodeEnd":641,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java#L605-L641","documentation":"For WAR projects Jib builds a Jetty-based servlet container image and constructs its own entrypoint (launching the Jetty start.jar); settings like mainClass, extraClasspath, jvmFlags, and expandClasspathDependencies are irrelevant and silently ignored, so Jib warns when they are set.","triggerScenarios":"A WAR-packaging project processed via computeEntrypoint where the raw configuration has a mainClass present, non-empty jvmFlags, a non-empty extraDirectory classpath, or expandClasspathDependencies=true.","commonSituations":"Copying JVM flags or mainClass settings from a JAR-based Jib configuration into a WAR project; forgetting to remove Java-app entrypoint settings after converting a project from jar to war packaging.","solutions":["Remove mainClass, jvmFlags, extraClasspath (extraDirectories classpath), and expandClasspathDependencies from the Jib configuration of the WAR project","Use jvmFlagsForJettyRunImage/base image configuration appropriate for WAR deployments if JVM tuning is needed","Set a custom base image if you need a different servlet container entrypoint","Accept the default Jetty entrypoint (java -jar /usr/local/jetty/start.jar --module=ee10-deploy) for WAR images"],"exampleFix":"// before (build.gradle, war project)\njib {\n  mainClass = 'com.example.Main'\n  jvmFlags = ['-Xms512m']\n}\n// after\njib {\n  container { /* WAR project: entrypoint is provided by Jetty base image */ }\n}","handlingStrategy":"validation","validationCode":"if (\"war\".equals(project.getPackaging())) {\n  // assert Jib java-app options are unset\n  if (mainClass != null || !jvmFlags.isEmpty()) {\n    System.out.println(\"WAR project: mainClass/jvmFlags/extraClasspath will be ignored by Jib\");\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep separate Jib config profiles for jar vs war modules","Remove Java-app entrypoint settings when converting a module to war packaging","Use container.baseImage for custom servlet containers instead of entrypoint-related options"],"tags":["jib","war","config","entrypoint"],"backgroundTag":"unsupported-config-value","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}