Recaf icon indicating copy to clipboard operation
Recaf copied to clipboard

Respect MAVEN_USER_HOME in MavenUtil

Open dreamscached opened this issue 2 years ago • 2 comments

Hello! I am the maintainer of AUR packages for your software. I'm unsure if version 2 is still being maintained or you're occupied by work on v3, however, I have encountered a problem when packaging a VCS package for AUR.

The issue is about MavenUtil class which uses a hardcoded path for Maven local repository, which may be affected by MAVEN_USER_HOME or other Maven settings:

https://github.com/Col-E/Recaf/blob/ca07fc05038ec8697a863bf471bdd244adbfb8bb/src/main/java/me/coley/recaf/util/MavenUtil.java#L168-L173

In my AUR package I resorted to use of the following patch:

171a172,173
>  		if (System.getenv("MAVEN_USER_HOME") != null)
>  			return Paths.get(System.getenv("MAVEN_USER_HOME"), "repository");

I think it wouldn't harm to also account for environment variable or Maven settings, if possible, instead of using hardcoded path. Thank you.

dreamscached avatar Mar 03 '23 08:03 dreamscached

Originally it was an issue with tests being run and creating ~/.m2 folder without being told so, since Maven was set to use custom settings.xml which clearly defined that Maven home folder wasn't in ~/.m2 but somewhere else.

dreamscached avatar Mar 03 '23 08:03 dreamscached

I'm unsure if version 2 is still being maintained

That is correct, I am currently busy with v3. In fact, there's a heavy rewrite going underway. But with that in mind, outline all your needs and I'll see what I can do about addressing them in v3.

For awareness, v3 is going to be bumping the minimum version of Java required to run Recaf, most likely to 17.

The plan is to have a launcher module for users not using a package manager, and then publish the necessary files for repository maintainers to keep their own mechanisms for keeping up-to-date without the launcher.

Using the following patch

👍

Looks like a fine solution.

Col-E avatar Mar 03 '23 08:03 Col-E