bazel-contrib / bazel-contrib/rules_jvm_external

maven_install unusable on Windows due to hashbang in coursier executable

Open
#464 7 comments 0 reactions 0 assignees View on GitHub
coursier-cli os:windows
Dominant language
Java
Stars
373
Forks
301
Avg merge
7d 17h
Merged PRs (30d)
3

Description

Trying to use a simple maven_install rule on windows (which works fine on mac) results in the following error:

`activity depends on @maven//:com_google_android_gms_play_services_nearby in repository @maven which failed to fetch. no such package
'@maven//': Unable to run coursier: java.io.IOException: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\kalma\_bazel_kalma\waikar5b\external\maven\coursier"): %1 is not a valid Win32 application.
(error: 193)`

This problem is obvious if you open the coursier binary it points to, as it is actually wrapped in a shell script, and starts with:
`#!/usr/bin/env sh
nargs=$#
`

Obviously on Windows this is not supported as a standard executable. I tried using different versions of rules_jvm_external and bazel itself to see if perhaps it worked historically, but it doesn't seem so.

Contributor guide

Open the contributing guide

Research direction

Start at the maven_install entry point and the coursier executable named in the error; inspect how the shell-wrapped executable is launched on Windows. Reproduce the CreateProcessW failure with the sample dependency, then verify that the Windows invocation can fetch the Maven artifact successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, shell
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.