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: [email protected]
For additional commands, e-mail: [email protected]

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



Reply via email to