apache / apache/maven

[MNG-8768] Add a function for conditional profile activation evaluating to true if a certain executable can be found in the system path

Open
#10,115 1 comment 0 reactions 0 assignees View on GitHub
priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Juan Farré](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER308727)** opened **[MNG-8768](https://issues.apache.org/jira/browse/MNG-8768?redirect=false)** and commented

I have a use case that I think is of general interest.

I am generating a native image with GraalVM native-maven-plugin, and I'd like to autodetect the presence of the musl gcc compiler wrapper x86_64-linux-musl-gcc in the path to generate a static executable.

When using GraalVM to build an image with the following options,

```bash
native-image --static --libc=musl ...
```

it tries to use x86_64-linux-musl-gcc to compile. If it isn't available in the system path, it crashes.

My idea is to activate a profile when building under Linux x86_64 and the executable x86_64-linux-musl-gcc is detected in the path. This profile would add the options --static and --libc=musl to the native-maven-plugin configuration.

It could be a function like:

```bash
executable(executable_name_or_path)
```

It would search for the executable in the system path (unless a path is given) and check that it's actually an executable.

I think this can be useful for many other use cases.

---

This issue is a sub-task of [MNG-8292](https://issues.apache.org/jira/browse/MNG-8292)

Contributor guide

Open the contributing guide

Research direction

Start by tracing Maven's profile activation mechanism and its existing activation functions; the issue proposes an executable(executable_name_or_path) condition that searches PATH or a supplied path and verifies executability. Use MNG-8768 and parent issue MNG-8292 for context, then add coverage showing profiles activate only when the requested executable is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.