Opened 13 years ago

Last modified 5 years ago

#30652 assigned enhancement

maven_select @0.3 soft link for maven installation needs to be created

Reported by: hxliang1982@… Owned by:
Priority: Low Milestone:
Component: ports Version:
Keywords: Cc:
Port: maven_select

Description

M2_HOME should be set in order to make maven work. "port select --set maven maven2" only sets up link of "mvn", so each time I change maven version, I have to modify M2_HOME, or I need to create a soft link somewhere by myself.

So suggestion is to add a soft link to /opt/local/share/java, each time maven version is selected, update this soft link.

Basically, "base", "maven2", "maven3" should be updated by adding one entry

Change History (13)

comment:1 Changed 13 years ago by hxliang1982@…

sorry for wrong summary, should be "maven_select @0.3 soft link for maven installation needs to be created"

comment:2 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: maven M2_HOME removed
Owner: changed from macports-tickets@… to blair@…
Port: maven_select added
Summary: maven_select @0.3 sot link for maven installation needs to be createdmaven_select @0.3 soft link for maven installation needs to be created

comment:3 Changed 13 years ago by blair (Blair Zajac)

Patch welcome and I can commit it.

comment:4 Changed 13 years ago by hxliang1982@…

add one line to "base": share/java/maven

add one line to "maven2": share/java/maven2

add one line to "maven3": share/java/maven3

not sure about maven1, should be similar.

sorry i didn't create a patch file as it is rather simple.

btw, it could be nice that port will propose user to "export M2_HOME=/opt/local/share/java/maven" before executing "mvn".

thanks.

comment:5 Changed 13 years ago by blair (Blair Zajac)

I can reproduce the problem. Both $prefix/bin/mvn2 and $prefix/bin/mvn3 they both figure out M2_HOME if it isn't set by following the symlinks, but they don't handle double symlinks.

I think the real solution is to update mvn2 and mvn3 to properly follow multiple symlinks. I'd rather not have a solution that depends upon M2_HOME being set.

comment:6 Changed 13 years ago by hxliang1982@…

agreed, but this env is not set just f tor maven itself, many IDEs also read this to locate maven. so i think it is still needed.

comment:7 Changed 13 years ago by blair (Blair Zajac)

So maybe having $prefix/etc/profile.d/maven that sets M2_HOME appropriate would be good? This could be handled by the select system.

comment:8 Changed 13 years ago by hxliang1982@…

i'm not sure how things under profile.d work, so it is possible to explain a little bit more about scripts under profile.d. things like how they get executed.

thanks.

comment:9 Changed 13 years ago by blair (Blair Zajac)

Linux systems have this in /etc/profile:

for i in /etc/profile.d/*.sh; do
  if [ -r $i ]; then
    . $i
  fi
done

So we would tell people to have something similar in their ~/.profile.

comment:10 Changed 13 years ago by hxliang1982@…

looks perfect. but is there any backward compatibility issue, since for bash-completion, port has already told me to add following code:

if [ -f /opt/local/etc/bash_completion ]; then
    . /opt/local/etc/bash_completion
fi

and there is one bash_completion.sh file under profile.d but never used, so things might get executed twice if i don't remove above thing while adding new stuff.

anyway, your suggestion is a good solution.

comment:11 Changed 13 years ago by blair (Blair Zajac)

We should get bash-completion updated then. I opened #30664. But yes, it could be sourced twice.

comment:12 in reply to:  11 Changed 13 years ago by hxliang1982@…

thanks for your patient help, appreciate it very much. :)

comment:13 Changed 5 years ago by mf2k (Frank Schima)

Owner: blair deleted
Status: newassigned
Version: 2.0.1
Note: See TracTickets for help on using tickets.