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

Galleon 6.0.0+ not running in docker image - Failed to resolve Maven universe org.jboss.universe:community-universe #349

Open
rombow opened this issue Jun 5, 2024 · 6 comments

Comments

@rombow
Copy link

rombow commented Jun 5, 2024

Reproducing:

  1. run docker, like debian slim
  2. download and unpacking galleon 6.0.0+
  3. run: galleon/bin/galleon.sh install wildfly:current#32.0.1.Final

Error:
`Error: org.jboss.galleon.universe.maven.MavenUniverseException: Failed to resolve Maven universe org.jboss.universe:community-universe

  • Failed to resolve Maven universe org.jboss.universe:community-universe
  • Failed to determine the latest version of org.jboss.universe:community-universe:jar:[0.0,). Make sure the remote Maven repository is properly configured and available.`

Problem is in code:

repoPath = new StringBuilder(PropertyUtils.getSystemProperty("user.home")).append(File.separatorChar)

this uses PropertyUtils.getSystemProperty("user.home") which is not set correctly in the docker image

I think a better solution would be to use the $HOME environment or similar, or maybe try to set "user.home" in the galleon.sh script.

Current workaround is set manually:
JAVA_OPTS=-Duser.home=$HOME galleon/bin/galleon.sh install wildfly:current#32.0.1.Final

@jfdenise
Copy link
Contributor

jfdenise commented Jun 5, 2024

@rombow , thank-you. What is the value in the docker image of the user.home? That is an important system property for Java application, I am surprised that it is not set correctly?

@rombow
Copy link
Author

rombow commented Jun 5, 2024

Idk how i can print galleon parameters, but reponse of bin/galleon.sh maven get-info is:

rombow@6c685bab6f02:~/galleon$ bin/galleon.sh maven get-info
======================= ============================================================== 
Configuration Item      Value                                                          
======================= ============================================================== 
Default release policy  daily                                                          
Default snapshot policy never                                                          
Enable release          true                                                           
Enable snapshot         false                                                          
Local repository        /nonexistent/.m2/repository                                    
Maven xml settings      No settings file set                                           
Offline                 false                                                          
Remote repositories     maven-central 
                         url=https://repo1.maven.org/maven2/ 
                         type=default 
                         release=true 
                         releaseUpdatePolicy=daily 
                         snapshot=false 
                         snapshotUpdatePolicy=never 
                        jboss-public-repository-group 
                         url=https://repository.jboss.org/nexus/content/groups/public/ 
                         type=default 
                         release=true 
                         releaseUpdatePolicy=daily 
                         snapshot=false 
                         snapshotUpdatePolicy=never 
                        jboss-ga 
                         url=https://maven.repository.redhat.com/ga/ 
                         type=default 
                         release=true 
                         releaseUpdatePolicy=daily 
                         snapshot=false 
                         snapshotUpdatePolicy=never 

I noticed that the Local repository /nonexistent/.m2/repository value is not very good and when I try to set the correct value it fails again :

rombow@6c685bab6f02:~/galleon$ mkdir $HOME/.m2
rombow@6c685bab6f02:~/galleon$ mkdir $HOME/.m2/repository
rombow@6c685bab6f02:~/galleon$ bin/galleon.sh maven set-local-repository "$HOME/.m2/repository"
Error: Set local repository failed.
 * /nonexistent/.galleon-cli/cli-config

My docker image is a custom layered, java and maven are not installed. We just copied the correct version to HOME/java directory and set the MAVEN_CONFIG, JAVA_HOME, MAVEN_VERSION, MAVEN_HOME and PATH env variables manually. We try our docker to stay in absolut control what is where installed

@jmesnil
Copy link
Member

jmesnil commented Oct 8, 2024

@rombow I suspect you have no user.home in Java, $HOME points to /nonexistent because you don't have any user created in your Dockerfile.
If you create a user, this should resolve your issue without further tweak.

@rombow
Copy link
Author

rombow commented Oct 8, 2024

@jmesnil We have a non-root user created with linux commands on both debian and alpine versions too (similar syntax)

RUN set -x; \
    addgroup --gid $USER_GID $SYSTEM_USER_GROUP && \
    adduser --system --disabled-password --uid ${USER_UID} --disabled-login --gecos ${SYSTEM_USER} --gid ${USER_GID} ${SYSTEM_USER_GROUP}

@jmesnil
Copy link
Member

jmesnil commented Oct 9, 2024

@rombow Do you have an instruction USER ${USER_UID} before the RUN instructions that execute galleon (and Java)?

@rombow
Copy link
Author

rombow commented Oct 9, 2024

Of course, the layer (where the snippet comes from) defines the user and configures it. In the lower part of the layers, they switch between user and root, and back. I am also wonder why user.home is not set, maybe it's a docker bug or something linux that I don't know about

Either way, this Galleon problem is basically about java.home, if it's not set it could be solved somehow, maybe we could try to get a user from ENV or some other way

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

No branches or pull requests

3 participants