Bug 178644 - add a shortcut for "Build with dependencies" project action
add a shortcut for "Build with dependencies" project action
Status: NEW
Product: projects
Classification: Unclassified
Component: Maven
6.x
All All
: P3 with 1 vote (vote)
: TBD
Assigned To: Milos Kleint
issues@projects
: USABILITY
Depends on: 153420
Blocks:
  Show dependency treegraph
 
Reported: 2009-12-15 03:14 UTC by anli
Modified: 2012-06-19 16:14 UTC (History)
5 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description anli 2009-12-15 03:14:43 UTC
It is annoying to use project context menu for such frequently used activity as "Build with dependencies" is. At case of Maven projects Maven provokes a modularization and, as result, more projects amount, complicating a surfing on project explorer. So, it would be handy to have a shortcut for the action.

Here

http://forums.netbeans.org/viewtopic.php?t=20960

Dafe Simonek pointed me the problem is wider rather Maven-project related only. So, selecting Generic Projects UI component instead of Maven component.
Comment 1 Jesse Glick 2010-04-28 14:37:13 UTC
This action is defined by the Maven support; there is no general meaning for "build with dependencies". Any user can create such a shortcut (to Actions/Project/org-netbeans-modules-maven-buildWithDependencies.instance in 6.9) for themselves; it is up to the Maven module to predefine one or not.
Comment 2 Petr Jiricka 2010-04-28 21:18:43 UTC
So, wouldn't it be useful if the user could configure whether the default shortcut (F11) and the toolbar button for Build really does "Build" or "Build with dependencies"? I think in some cases (e.g. EAR), "Build with dependencies" is the more sensible default, so F11 should do "Build with dependencies". This could be set on the per-project basis. What do you think?
Comment 3 Jesse Glick 2010-04-28 21:33:47 UTC
(In reply to comment #2)
> I think in some cases (e.g. EAR)

First I had heard of such a command in other project types.

> This could be set on the per-project basis.

Per project? Or per project type?

Note that project types such as Maven are already free to add a checkbox (in Options > Misc > Maven, and/or in a particular project's Properties dialog) which would have the effect of making the standard Build action (F11, toolbar button, main menu item) also build dependencies.

In fact, Java SE projects have long had a "Build Projects on Classpath" checkbox in the Libraries panel which does essentially this. Then there is no need for a separate action. (You could still have a "Build without Dependencies" action in the project's context menu if you like, visible only when this checkbox is set; this would have no accelerator or other presenter. We have not seen a need for it in Java SE projects, however.)

I think making the regular Build action optionally also build dependencies is simpler and more intuitive than creating a separate action, and more consistent with Java SE projects. In the particular case of Maven, there are a number of options for builds which it may be fruitful to set for certain workflows, such as --also-make, --also-make-dependents, --update-snapshots, etc.; it would not make sense for the generic project system UI to have special treatment for all this.
Comment 4 Petr Jiricka 2010-04-28 21:47:28 UTC
> > I think in some cases (e.g. EAR)
> First I had heard of such a command in other project types.

I am not talking about another project type, I am talking about Maven-based EAR.

> Project types such as Maven are already free to add a checkbox

I agree this could well be the solution.

> Then there is no need for a separate action.

Quite possibly. I agree this could be resolved within the Maven area.
Comment 5 Petr Jiricka 2010-05-10 11:42:19 UTC
I just noticed the following comment by Milos in bug 157564: 
'go to Actions panel in customizer and check the "build with dependencies" checkbox.'

I did not know this, but yes, the truth is that if you go to a Maven project's Actions category in project properties, select Build Project and check the Build With Dependencies checkbox, the F11 shortcut will be linked to Build with dependencies. 

So isn't this what we need? Can we just close this as WORKSFORME?
Comment 6 Antonin Nebuzelsky 2010-05-10 15:45:56 UTC
> So isn't this what we need? Can we just close this as WORKSFORME?

Or how about adding "build with dependencies" as the default for Build, Run, Debug, Profile actions via nbactions.xml in our EAR and RCP archetypes?

I don't see a reason why a user would want to invoke these actions on "EAR" and "Platform based Application" maven projects without the "build with dependencies".

What do others think? Ken, Jara, Dafe?

Let's decide quickly and integrate the change this week if agreed.
Comment 7 Kenneth Ganfield 2010-05-11 09:24:52 UTC
I am actually more inclined to keep it the way it is, but wish there was some better way to call attention to the option in the project Properties window to make Build with Dependencies the default for the selected action.

I think that making it the default could cause some confusion about why some projects, esp EAR, are not building correctly because in some cases the user would need to edit the dependency details in the pom 

See also:
157564, 177214, 184979
Comment 8 David Simonek 2010-05-11 11:45:13 UTC
I see. I was tempted to agree with Tonda, but the bugs Ken is pointing out and the documentation http://maven.apache.org/guides/mini/guide-multiple-modules.html made me change my opinion - I vote for leaving things as they are for 6.9 and close this as Petr mentioned, Milos knew what he was doing.

Main reason against automatic "Build with dependencies" it simply that it won't work in many cases. It is implemented using "--also-make" cmd line option (see docs above) of mvn, which essentially means "build portion of multimodule project", not the whole one.

However I also agree with Ken that some more intuitive UI should be invented. Ideally something that would help user to run build of parent pom if user really wants to rebuild whole multi module project/app.
Comment 9 Jesse Glick 2010-05-11 17:13:52 UTC
(In reply to comment #8)
> Main reason against automatic "Build with dependencies" it simply that it won't
> work in many cases. It is implemented using "--also-make" ...,
> which essentially means "build portion of multimodule
> project", not the whole one.

Which is exactly what it says it will do - builds the dependencies.

> I also agree with Ken that some more intuitive UI should be invented.

Consider also making it more discoverable; a radio button mode in the context menu of the project might be in order.

> Ideally something that would help user to run build of parent pom if user
> really wants to rebuild whole multi module project/app.

Why wouldn't you just open the topmost parent POM module and set it as the main project?
Comment 10 David Simonek 2010-05-11 18:09:47 UTC
(In reply to comment #9)
> Why wouldn't you just open the topmost parent POM module and set it as the main
> project?

parent POM *is* opened and it *was* opened as the main project. I was grilled to change main project to NB platform app/EAR module so that global shortcuts for Run/Debug works.

In Maven multi module project there is no "one main project", there are typically two - one for building and other one for running. Personally I think we are spending too much time on hacking. We should redefine main project concept to suit Maven needs or let it be IMHO.
Comment 11 Jesse Glick 2010-05-11 18:20:48 UTC
(In reply to comment #10)
> parent POM *is* opened and it *was* opened as the main project. I was grilled
> to change main project to NB platform app/EAR module so that global shortcuts
> for Run/Debug works.

Can the ActionProvider for the POM project be made to delegate to the NBM/EAR/etc. child for COMMAND_RUN etc.? That would seem most natural to me; then you would have the main project set to the POM project (probably where people would expect it to be by analogy with typical Ant-based project types), and all main-project-sensitive actions would do something useful.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo