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

Folder ${M2_REPO} gets created #706

Closed
hohwille opened this issue Feb 21, 2022 · 6 comments · Fixed by #814
Closed

Folder ${M2_REPO} gets created #706

hohwille opened this issue Feb 21, 2022 · 6 comments · Fixed by #814
Assignees
Labels
bug Something isn't working

Comments

@hohwille
Copy link
Member

Expected behavior

All maven artifacts should go to the local maven repo configured via devon.properties (by default $DEVON_IDE_HOME/conf/.m2/repository but can also be changed to e.g. ~/.m2/repository via devon.properties).

Actual behavior

For some odd reason some tool or script causes a folder named ${M2_REPO} being created in the top-level IDE installation $DEVON_IDE_HOME).

Steps to reproduce (bug) / Use Case of feature request (enhancement)

  1. Create a devonfw-ide installation and run setup
  2. Use this IDE to work with maven and eclipse in your project
  3. at some point (exact steps for 2. still unclear) this magic ${M2_REPO} folder appears and is filled with some maven artifacts.

Related/Dependent Issues

Comments/Hints:

Seems as if at some point ${M2_REPO} is used as variable but does not properly get resolved leading to the fact that it is used as relative path for the maven repository created as folder.

Affected version:

  • OS: happened both on Windows and Mac
@hohwille hohwille added the bug Something isn't working label Feb 21, 2022
@tobka777
Copy link
Member

tobka777 commented Mar 7, 2022

I have been able to reproduce the problem.
To do this, I have clone the project https://github.com/devonfw-sample/devon4quarkus-reference.git and run mvn install.
I have observed that the ~/.m2 folder is created when the tests run.
It seems to be an issue when using Quarkus tests.
I found the following issue about this:
quarkusio/quarkus#9505

With settings, you can add an option to the command to read the settings. Then it seems to work.
devon mvn install --settings=$DEVON_IDE_HOME/conf/.m2/settings.xml
Alternative -Dmaven.settings= should work also.

Now I am getting an error: Caused by: java.lang.IllegalStateException: Please configure the datasource URL for the default datasource or ensure the Docker daemon is up and running. Maybe this is project related, but I dont know.

@hohwille What do you think about it?

@maybeec
Copy link
Member

maybeec commented Mar 7, 2022

I have seen similar issues just working on cobigen.
I am not sure whether it's a quarkus thing. Possibly some Maven or junit issue not resolving the variable. Anyhow I could not find a way to reproduce this issue. Nice that you found one! We need to have a closer look at it

@hohwille
Copy link
Member Author

My suggestion for the next steps is:

  • setup a new devonfw-ide (e.g. "test")
  • verify that after installation the ${M2_REPO} folder is not present
  • then stepwise do changes until ${M2_REPO} gets created and we can reproduce what action is causing it to be created

Suggestion for these stepwise changes:

cd workspaces/main
devon java create com.example.app
cd app
mvn install

If no ${M2_REPO} was created in IDE root folder, continue with eclipse (my assumption is that eclipse maven plugin m2e is causing this error).

devon eclipse import .
devon eclipse

Now in eclipse ensure the newly created project (app) is imported and build with maven dependencies, etc.
Select the project in Eclipse and hit [Alt][F5] and confirm popup with OK.
I guess after some playing around like this the ${M2_REPO} folder should appear.

@alfeilex
Copy link
Member

alfeilex commented Jun 23, 2022

The problem is caused because the ${M2_REPO} variable is not resolved in conf/.m2/repository/settings.xml (...). This creates a folder with the same name as the variable when adding Maven dependencies in Eclipse.

I could fix the bug by updating the following M2E Plugin in Eclipse.

M2E - POM Editor using LemMinX language Server

@hohwille
Copy link
Member Author

The problem is caused because the ${M2_REPO} variable is not resolved in conf/.m2/repository/settings.xml (...). This creates a folder with the same name as the variable when adding Maven dependencies in Eclipse.
...

Thank you for your analysis. So my assumption and gut feeling was kind of correct.
Great that you found a solution and fix for it. 👍

@tobka777
Copy link
Member

Thank you @alfeilex for the analysis and the fix 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
6 participants