Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFE] new goals "listFeatures" and "listAllFeatures" #1845

Open
bmarwell opened this issue Nov 18, 2024 · 1 comment
Open

[RFE] new goals "listFeatures" and "listAllFeatures" #1845

bmarwell opened this issue Nov 18, 2024 · 1 comment

Comments

@bmarwell
Copy link
Contributor

Hi, I think a goal like this might be helpful:

listFeatures

Lists all features available in the currently downloaded wlp / ol package.
Effectively calls:

./bin/featureManager featureList ${tempfile}.xml

The file should be stored in a configured location which has a sensible default.

listAllFeatures

Downloads the features json file from the configured repository.

  • uses com/ibm/websphere/appserver/features/features/24.0.0.6/features-24.0.0.6.json when IBM Liberty Profile (wlp) is used
  • uses io/openliberty/features/features/24.0.0.6/features-24.0.0.6.json otherwise
  • uses Maven settings, not the featureManager/featureUtility
  • unless a file ./etc/featureUtility.properties was provided -- then featureUtility is used or at least the configured mirrors

Will create the same file as above but with all available features.

optional settings/features

  • Create a text file with just the listed feature names, so inter-dependencies and conflicts between features are omitted.
  • listAllFeatures with an all-GA-features-package (this package is only available for OL if I am not mistaken).
  • configuration option outputFeaturesFile, e.g. to strip the version number.
  • Should obey artifact if given.
  • May be useful in conjunction with schemaGen utility (not implemented in this plugin).

Let me know what you think. 😊
No priority here, but I think this might be useful.

@bmarwell
Copy link
Contributor Author

Quick workaround using three maven plugins and additional resource directories:

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <directory>${generate.resources.liberty}</directory>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>io.openliberty.tools</groupId>
        <artifactId>liberty-maven-plugin</artifactId>
        <configuration>
          <serverName>cfggenerator</serverName>
          <features>
            <acceptLicense>true</acceptLicense>
          </features>
        </configuration>
        <executions>
          <execution>
            <id>liberty-install</id>
            <goals>
              <goal>install-server</goal>
            </goals>
            <phase>generate-resources</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>

        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-sources</id>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <target>
                <mkdir dir="${wlpFeatures.output.directory}" />
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-liberty-wlpFeatures</id>
            <goals>
              <goal>exec</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <forceJava>true</forceJava>
              <executable>java</executable>
              <arguments>
                <argument>--add-opens</argument>
                <argument>java.base/java.lang=ALL-UNNAMED</argument>
                <argument>--add-exports</argument>
                <argument>java.base/sun.security.action=ALL-UNNAMED</argument>
                <!-- add-exports openjceplus/com.ibm.misc=ALL-UNNAMED -->
                <argument>-Dfile.encoding=UTF-8</argument>
                <argument>-Djava.awt.headless=true</argument>
                <argument>-jar</argument>
                <argument>${build.directory}/liberty/bin/tools/ws-featureManager.jar</argument>
                <argument>featureList</argument>
                <argument>${wlpFeatures.output.directory}/features.xml</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

The file can then be read by any class. The call is actually just taken from featureManager sh script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants