Skip to content

Pass the loose app file to the binary scanner to generate features - #534

Merged
turkeylurkey merged 7 commits into
OpenLiberty:mainfrom
turkeylurkey:issue-2063
Sep 21, 2026
Merged

turkeylurkey merged 7 commits into
OpenLiberty:mainfrom
turkeylurkey:issue-2063

Conversation

@turkeylurkey

@turkeylurkey turkeylurkey commented Aug 14, 2026 •

Copy link
Copy Markdown
Member

Related to #2063, #2088

Accept the loose app descriptor file name as an argument. Parse this file and pass all the referenced files and directories to the binary scanner when optimize is on. If this file is missing then print a warning message and fall back to using the classes directories.

Signed-off-by: Paul Gooderham <turkeyonmarblerye@gmail.com>
Signed-off-by: Paul Gooderham <turkeyonmarblerye@gmail.com>
Signed-off-by: Paul Gooderham <turkeyonmarblerye@gmail.com>
Signed-off-by: Paul Gooderham <turkeyonmarblerye@gmail.com>
Comment thread src/main/java/io/openliberty/tools/common/plugins/util/FeatureGeneratorUtil.java Outdated
Comment thread src/main/java/io/openliberty/tools/common/plugins/util/FeatureGeneratorUtil.java Outdated
@TrevCraw

Copy link
Copy Markdown
Contributor

Discussed further with @turkeylurkey. Next steps:

  • Update getBinaryInputs() logic in a couple spots:
    • Handle passing regular archive file to binary scanner.
    • Avoid falling back to passing class directories. If the archive file or loose app file is missing or invalid, we should fail the generate-features goal with an Exception.
  • Update looseConfigFilePath to archiveFilePath - this should represent either the regular archive file or the loose app file
  • Consider surfacing an exception early on in the generate-features goal if the archive file (regular or loose app) does not exist.

Signed-off-by: Paul Gooderham <turkeyonmarblerye@gmail.com>
@turkeylurkey

Copy link
Copy Markdown
Member Author

N.B. we currently call the scanner if there are no inputs of any kind:

        // log as warning and continue to call feature generator to detect conflicts in
        // user specified features
        getLog().warn(NO_CLASSES_DIR_WARNING);

Signed-off-by: Paul Gooderham <turkeyonmarblerye@gmail.com>
@turkeylurkey

Copy link
Copy Markdown
Member Author

Sample output if the app is missing for command line mvn liberty:generate-features

[ERROR] Failed to execute goal io.openliberty.tools:liberty-maven-plugin:4.0.0-SNAPSHOTpg:generate-features (default-cli) on project demo-devmode-maven: Failed to generate a working set of features. An error occurred generating features, no input files were specified -> [Help 1]

Failed to generate a working set of features. is in one part of the code.
An error occurred generating features, no input files were specified is the message in FeatureGeneratorUtil in ci.common (similar will appear in LGP)

@turkeylurkey

Copy link
Copy Markdown
Member Author

When there are no files in the app config file the message in dev mode is:

[INFO] Running liberty:generate-features
[ERROR] Failed to generate a working set of features. An error occurred generating features, no input files were specified.
Disabling the automatic generation of features. Feature generation can be enabled in the dev mode menu by typing 'g' and pressing Enter.

@turkeylurkey

turkeylurkey commented Sep 18, 2026 •

Copy link
Copy Markdown
Member Author

When there is an ioexception reading the app descriptor (xml file) the message is:

[ERROR] Failed to generate a working set of features. An error occurred reading the application descriptor file:/Users/tl/testing2026/demo-devmode/target/liberty/wlp/usr/servers/defaultServer/apps/demo-devmode-maven.war.xml.
Disabling the automatic generation of features. Feature generation can be enabled in the dev mode menu by typing 'g' and pressing Enter.

@TrevCraw

Copy link
Copy Markdown
Contributor

Sample output if the app is missing for command line mvn liberty:generate-features

[ERROR] Failed to execute goal io.openliberty.tools:liberty-maven-plugin:4.0.0-SNAPSHOTpg:generate-features (default-cli) on project demo-devmode-maven: Failed to generate a working set of features. An error occurred generating features, no input files were specified -> [Help 1]

Failed to generate a working set of features. is in one part of the code. An error occurred generating features, no input files were specified is the message in FeatureGeneratorUtil in ci.common (similar will appear in LGP)

We should be more explicit about what files were not found and what the user can do about it. Something like:

Failed to generate a working set of features. No application archive file found. To generate features, it is required to package and deploy your application archive file.

@turkeylurkey

Copy link
Copy Markdown
Member Author

During dev mode the message is almost the same when the file is not found:

[ERROR] Failed to generate a working set of features. No application archive file found. To generate features, it is required to package and deploy your application archive file.
To disable the automatic generation of features, type 'g' and press Enter.

@turkeylurkey

turkeylurkey commented Sep 18, 2026 •

Copy link
Copy Markdown
Member Author

In the unlikely event there is an IOException while reading the app. config. in .war.xml:

during start up we exit

[ERROR] Failed to execute goal io.openliberty.tools:liberty-maven-plugin:4.0.0-SNAPSHOTpg:dev (default-cli) on project demo-devmode-maven: An error occurred reading the application file during generation of features. Ensure the file exists and is readable. To disable the automatic generation of features, type 'g' and press 'Enter' once dev mode is running or restart dev mode with -DgenerateFeatures=false. -> [Help 1]

while running dev mode we soldier on

[ERROR] An error occurred reading the application file during generation of features. Ensure the file exists and is readable.
To disable the automatic generation of features, type 'g' and press Enter.

Signed-off-by: Paul Gooderham <turkeyonmarblerye@gmail.com>
@turkeylurkey
turkeylurkey merged commit 67c30d5 into OpenLiberty:main Sep 21, 2026
10 checks passed
@turkeylurkey
turkeylurkey deleted the issue-2063 branch September 21, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants