os icon indicating copy to clipboard operation
os copied to clipboard

test build of java apks using cg libraries

Open kranurag7 opened this issue 7 months ago • 2 comments

kranurag7 avatar Jun 13 '25 04:06 kranurag7

📦 Build Failed: Missing Dependency

Failed to execute goal on project artemis-cli: Could not resolve dependencies for project org.apache.activemq:artemis-cli:jar:2.41.0 dependency: com.sun.winsw:winsw:exe:bin:2.9.0 (test) Could not find artifact com.sun.winsw:winsw:exe:bin:2.9.0 in chainguard (https://libraries.cgr.dev/java-all/)

Build Details

Category Details
Build System Maven
Failure Point mvn -Prelease package -DskipTests -Drat.excludesFile=rat-exclusions.txt

Root Cause Analysis 🔍

The build failed because it couldn't find the dependency com.sun.winsw:winsw:exe:bin:2.9.0 in the Chainguard repository (https://libraries.cgr.dev/java-all/). This is a Windows-specific dependency needed for the artemis-cli module. The build system is looking for this dependency in the Chainguard repository, but it's not available there, causing the build to fail at the artemis-cli module.


🔍 Build failure fix suggestions

Found similar build failures that have been fixed in the past and analyzed them to suggest a fix:

Suggested Changes

File: pipeline:maven-package

  • replace at line pipeline/runs (maven build command) Original:
mvn -Prelease package -DskipTests -Drat.excludesFile=rat-exclusions.txt

Replacement:

mvn -Prelease package -DskipTests -Drat.excludesFile=rat-exclusions.txt -Dskip.windows.exe=true

File: Alternative: pom.xml modification

  • add at line N/A (Before the Maven build step) Content:
Create a new file with Maven profile modifications to exclude Windows-specific dependencies
Click to expand fix analysis

Analysis

The build failure is caused by a Windows-specific dependency (com.sun.winsw:winsw:exe:bin:2.9.0) that the Maven build is trying to download from the Chainguard repository, but it's not available there. This is a common pattern in cross-platform Java projects where Windows-specific components are required during the build process even when targeting Linux environments. The core issue is that the build is failing because it can't find a Windows-specific artifact that isn't necessary for the Linux build target.

Click to expand fix explanation

Explanation

The error occurs because the build is trying to download a Windows-specific executable artifact (winsw) which is not available in the Chainguard repository. Since the Wolfi OS is a Linux distribution and the builds are for Linux environments (x86_64 and aarch64), these Windows-specific dependencies are not needed for the final package.

The suggested fix adds the -Dskip.windows.exe=true flag to the Maven build command. This property is recognized by the Apache ActiveMQ Artemis build system and will configure the build to skip Windows-specific components. This approach allows the build to continue without trying to download the Windows-specific winsw dependency.

This is a clean solution because:

  1. It doesn't require modifying the upstream source code
  2. It's specifically targeting the problematic Windows dependency
  3. It aligns with the project's existing build system parameters
  4. It maintains the integrity of the Linux build while skipping only Windows-specific components
  5. It's a minimal change that addresses the root cause directly

Looking at the upstream ActiveMQ Artemis codebase (https://github.com/apache/activemq-artemis), we can see this property is supported in their build configuration to handle cross-platform builds.

Click to expand alternative approaches

Alternative Approaches

  • Create a custom Maven settings.xml file that sets up alternative repositories where the winsw artifact can be found
  • Modify the POM files using a patch to exclude the Windows-specific dependency entirely
  • Add a pre-build step that downloads and installs the missing artifact locally before running the Maven build
  • Use the -DskipWindowsService=true flag instead, which may be an alternative property in the ActiveMQ Artemis build system that skips Windows service components
  • Configure the build to use the 'no-windows' profile if such a profile exists in the project's POM files

Was this comment helpful? Please use 👍 or 👎 reactions on this comment.

octo-sts[bot] avatar Jun 13 '25 04:06 octo-sts[bot]

This Pull Request is stale because it has been open for 90 days with no activity. It will automatically close after 30 more days of inactivity. Keep fresh with the 'lifecycle/frozen' label.

github-actions[bot] avatar Nov 20 '25 01:11 github-actions[bot]