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

mvnd fails if there is no .mvn/ dir in the user home #42

Closed
tadayosi opened this issue Jul 13, 2020 · 5 comments · Fixed by #46
Closed

mvnd fails if there is no .mvn/ dir in the user home #42

tadayosi opened this issue Jul 13, 2020 · 5 comments · Fixed by #46
Milestone

Comments

@tadayosi
Copy link
Member

tadayosi commented Jul 13, 2020

Right after mvnd --install, mvnd fails with the following error:

$ mvnd --version
Maven Daemon 0.0.0 (native)
Exception in thread "main" java.lang.IllegalStateException: Could not detect maven.multiModuleProjectDirectory by climbing up from [/home/tasato] seeking a .mvn directory. You may want to create a .mvn directory in the root directory of your source tree.
	at org.jboss.fuse.mvnd.client.Environment.lambda$findMultiModuleProjectDirectory$4(Environment.java:127)
	at org.jboss.fuse.mvnd.client.Environment$EnvValue.get(Environment.java:246)
	at org.jboss.fuse.mvnd.client.Environment$EnvValue.asPath(Environment.java:258)
	at org.jboss.fuse.mvnd.client.Environment.findMultiModuleProjectDirectory(Environment.java:131)
	at org.jboss.fuse.mvnd.client.ClientLayout.getEnvInstance(ClientLayout.java:45)
	at org.jboss.fuse.mvnd.client.DefaultClient.lambda$main$0(DefaultClient.java:69)
	at org.jboss.fuse.mvnd.client.DefaultClient.execute(DefaultClient.java:170)
	at org.jboss.fuse.mvnd.client.DefaultClient.main(DefaultClient.java:69)

Manually creating a directory .mvn/ in the user home solves the error, but it's handy if mvnd auto resolves it.

@ppalaga
Copy link
Contributor

ppalaga commented Jul 13, 2020

Yeah, I admit it's not especially robust, but we basically mimic, what stock Maven does in mvn.[sh|cmd]. The only substantial difference is that while Maven can do without maven.multiModuleProjectDirectory we cannot (or maybe we could?).

it's handy if mvnd auto resolves it.

I wonder how? I do not think we can reliably autodetect the top level directory of any random multimodule project.

@tadayosi
Copy link
Member Author

I thought that mvnd could just mkdir $HOME/.mvn if it doesn't exist. Not sure if it's a silly hack or not though.

@gnodet
Copy link
Contributor

gnodet commented Jul 13, 2020

@tadayosi there's a misunderstanding here. mvnd is looking for [project]/.mvn dir to detect the root directory of a multiproject module, not $HOME/.mvn.

@ppalaga
Copy link
Contributor

ppalaga commented Jul 13, 2020

No, .mvn directory is supposed to mark the root of a multimodule maven project and we cannot know where it is. The bottom line is that mvnd --version shouldn't really require a maven project at all.

@tadayosi
Copy link
Member Author

tadayosi commented Jul 13, 2020

Thanks for the explanation. So there are a couple of suggestions here:

  1. Make mvnd --version (and possibly other non-project general options) not rely on .mvn/
  2. For project-related commands, show more use-friendly message in the absence of .mvn/ tracing up the dir hierarchy

ppalaga added a commit to ppalaga/mvnd that referenced this issue Jul 30, 2020
ppalaga added a commit to ppalaga/mvnd that referenced this issue Jul 30, 2020
ppalaga added a commit that referenced this issue Jul 30, 2020
Fix #42 mvnd fails if there is no .mvn/ dir in the user home
@ppalaga ppalaga added this to the 0.0.1 milestone Jul 30, 2020
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

Successfully merging a pull request may close this issue.

3 participants