You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Kenneth Fogel <kf...@dawsoncollege.qc.ca> on 2020/04/05 18:21:00 UTC

NetBeans Run for Maven projects does not process pom file properly

Before I rush off and file a report on JIRA for NB 12.0 Beta 2 I'd thought I'd run this by the group especially as it has been the behaviour of NB for as long as I have used it.

If I use Run (green triangle) and have a pom.xml dependency that is not already in the local repository then the dependency will not be downloaded from Maven Central or other location. It is for this reason I have told my students not to use the Run command for many years. Instead I place a defaultGoal in the pom (for FX its now ' clean javafx:run') and then do a Run Maven. Now that the default build system is Maven rather than Ant should not the Run command be effectively identical to Run Maven but with a goal from nbactions.xml?

Behaviour is a little different for web applications where Run Maven is still needed followed by NB Run to deploy.

Ken Fogel


Re: NetBeans Run for Maven projects does not process pom file properly

Posted by Ernie Rael <er...@raelity.com>.
On 4/5/2020 9:52 PM, Ernie Rael wrote:
> On 4/5/2020 11:21 AM, Kenneth Fogel wrote:
>> should not the Run command be effectively identical to Run Maven but 
>> with a goal from nbactions.xml?
>>
> ... experimentation would indicate that the defaultGoal is not needed 
> for javafx. I'd hazard to guess that improvements in maven and/or NB 
> over the last years have helped smooth out some of the rough edges, 
> like with populating the repository.

I think I was a bit optimistic. The answer seems to be: behavior depend 
on the maven project, in particular its pom.xml. The "Run command" is 
really not related to "Run Maven".

Creating "NewProject > JavaWithMaven > Java Application" gives you an 
essentially empty pom and no nbactions. Then "Project > properties > 
Actions; Actions: Run project" shows you what NB does by default for its 
run button/action; any changes or additions made in this properties 
dialog are reflected/saved in nbactions.xml. I guess the mapping of 
NetBeans buttons/menu-items to items in "Actions" is supposed to be 
intuitive.

This note was prompted because while looking at some other issues, I ran 
across a change that was made to javafx-maven-plugin a month ago, this 
line was added for jlink

    @Execute(phase = LifecyclePhase.PROCESS_CLASSES)

Which causes download/compilation first for jlink. (this was already 
present for javafx:run)

-ernie


>
> IMHO, if a project created through "Project > NewProject > ..." didn't 
> populate the repository with dependencies as needed, then an issue 
> should be filed.
>
> -ernie
>
>> Behaviour is a little different for web applications where Run Maven 
>> is still needed followed by NB Run to deploy.
>>
>> Ken Fogel
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: NetBeans Run for Maven projects does not process pom file properly

Posted by Ernie Rael <er...@raelity.com>.
On 4/5/2020 11:21 AM, Kenneth Fogel wrote:
>
> Before I rush off and file a report on JIRA for NB 12.0 Beta 2 I’d 
> thought I’d run this by the group especially as it has been the 
> behaviour of NB for as long as I have used it.
>
> If I use Run (green triangle) and have a pom.xml dependency that is 
> not already in the local repository then the dependency will not be 
> downloaded from Maven Central or other location. It is for this reason 
> I have told my students not to use the Run command for many years. 
> Instead I place a defaultGoal in the pom (for FX its now ‘ clean 
> javafx:run’) and then do a Run Maven.
>
I've only recently started working with maven, so I can't speak to how 
nb worked with maven in the past. I'm still pretty much a maven novice; 
I just searched "setting default goal in pom.xml" and now I see what you 
mean, litterally <build><defaultGoal>.

> Now that the default build system is Maven rather than Ant should not 
> the Run command be effectively identical to Run Maven but with a goal 
> from nbactions.xml?
>
I don't think the default build system is maven. I think NB finds the 
pom.xml (and maybe not having an nbproject directory? I'm not sure of 
the rules) and the pom.xml signals NetBeans to treat the project as 
maven. Here's my understanding/guesses.

I think it's as you describe it. NetBeans has action names associated 
with the buttons and other common IDE actions; in maven mode the actions 
map to common/simple maven goals. nbactions.xml is a mapping of the NB 
action to specific goals for the given project and is needed with 
specialized plugins, like javafx-maven-plugin. You can see that the 
<actionName>run calls out goals "clean javafx:run".

I shutdown netbeans, removed the open jfx artifacts from the maven 
repository, started netbeans (it wasn't happy with the project) and 
pressed the RunButton. In the output window I saw that for doing "--- 
jar ---" it populated the repository as needed and compiled and ran. I 
don't know enough about phases/build-plugins, but I guess it needed to 
build the jar on the way to run.

Bottom line, experimentation would indicate that the defaultGoal is not 
needed for javafx. I'd hazard to guess that improvements in maven and/or 
NB over the last years have helped smooth out some of the rough edges, 
like with populating the repository.

IMHO, if a project created through "Project > NewProject > ..." didn't 
populate the repository with dependencies as needed, then an issue 
should be filed.

-ernie

> Behaviour is a little different for web applications where Run Maven 
> is still needed followed by NB Run to deploy.
>
> Ken Fogel
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: NetBeans Run for Maven projects does not process pom file properly

Posted by Geertjan Wielenga <ge...@apache.org>.
After you create your OpenJFX Gluon applications in 12.0 Beta 2, just
right-click the project and choose Run or Debug to run or debug them.

Gj

On Sun, 5 Apr 2020 at 20:21, Kenneth Fogel <kf...@dawsoncollege.qc.ca>
wrote:

> Before I rush off and file a report on JIRA for NB 12.0 Beta 2 I’d thought
> I’d run this by the group especially as it has been the behaviour of NB for
> as long as I have used it.
>
>
>
> If I use Run (green triangle) and have a pom.xml dependency that is not
> already in the local repository then the dependency will not be downloaded
> from Maven Central or other location. It is for this reason I have told my
> students not to use the Run command for many years. Instead I place a
> defaultGoal in the pom (for FX its now ‘ clean javafx:run’) and then do a
> Run Maven. Now that the default build system is Maven rather than Ant
> should not the Run command be effectively identical to Run Maven but with a
> goal from nbactions.xml?
>
>
>
> Behaviour is a little different for web applications where Run Maven is
> still needed followed by NB Run to deploy.
>
>
>
> Ken Fogel
>
>
>