You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "R. Diez" <rd...@yahoo.de.INVALID> on 2020/10/19 12:26:13 UTC

Build with dependencies + debug in NetBeans in a single Maven invocation

Hi all:

I am migrating the following 2 Java applications and 1 "shared" library from NetBeans Ant-based projects to Maven:

https://sourceforge.net/p/filereadtest/code/ci/master/tree/

I have noticed that Maven is rather slow, which bugs me (I am very impatient for a part-time
Java developer). I suspect the start-up costs are a big factor, and GraalVM is probably not
quite ready yet to replace the standard JVM.

When I am writing code, I want to press a key in order to immediately start the application
under the debugger. All modified code, whether in the application or in the common library,
should be recompiled (if necessary). This is standard in most development environments for
most computer languages.

So, after starting NetBeans, I went to the project settings, "Actions", "Debug project" and ticked "Build With Dependencies".

I then noticed in the output window that Maven actually runs twice:

1) [...] mvn -DskipTests=true --also-make --projects QuickDiskTest install

2) [...] mvn [...] process-classes org.codehaus.mojo:exec-maven-plugin:1.5.0:exec

Is there a way to run Maven just once? Or does Maven not support building and running (under a debugger) in a single invocation?

Inside NetBeans, I could experiment with a new custom BuildWithDependenciesAndDebug action,
but there does not seem to be a way to fully control the command-line arguments for an action. There are fields for goals, profiles and properties, 
but that is probably not enough. Or am I mistaken here?

I am hoping that someone here could help me. I already posted this question in the NetBeans mailing list, but nobody answered:

http://mail-archives.apache.org/mod_mbox/netbeans-users/202009.mbox/%3C1652543010.678234.1601497297309%40mail.yahoo.com%3E

I cannot migrate this project away from NetBeans yet, because I am using the NetBeans GUI builder (Matisse) for the forms (see the .form files), which 
I guess is only available inside NetBeans.

Thanks in advance,
   rdiez

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Build with dependencies + debug in NetBeans in a single Maven invocation

Posted by "R. Diez" <rd...@yahoo.de.INVALID>.
> You mention maven is rather slow... It's taking me an average of 6
> seconds for a command line 'mvn clean install' to build all 4 pom's.
> I've got a MacBookPro (2013 model), 2.8 GHz Dual-Core Intel Core i7,
> 16GB Ram and SSD. I'm using Java 11.0.8 and Maven 3.6.3.

This is all interesting. It's such a small application we are talking about... I remember the times with Delphi. 6 seconds to run under the 
debugger was a long time then with a Pentium III processor! Software development has got worse with time... 8-(((

I am using NetBeans 12 LTS, and I can believe that IntelliJ is faster. But the difference you report is too big. My laptop is not that fast, 
and I am not seeing such long times (at least from the second compile-run attempt onwards). But with Maven projects, it is slower than with 
the old NetBeans Ant-based projects.


 > [...]
 > So maybe use IntelliJ when editing java code and switch to NetBeans if
 > you need to change the gui...

Switching IDEs, or even using 2 of them at the same time, is a pain. If somebody can figure out a trick to avoid the second Maven invocation 
in order to build and run the project under the debugger, I would rather stick to NetBeans, at least for now. I have already converted the 
projects to Maven, which is one step away from NetBeans, but I would rather not rush it now, I haven't got that much time nowadays.

Besides, IntelliJ is "half" commercial. If I stop using Matisse and start doing the UI by hand, I may as well switch to JavaFX (by hand 
too), ditch Java IDEs altogether and use Emacs, which is already my main editor for writing C++. Who knows if IntelliJ will last. It's not 
like I need a high-productivity Java IDE for a small open-source project that needs little maintenance.

Regards,
   rdiez

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Build with dependencies + debug in NetBeans in a single Maven invocation

Posted by John Patrick <nh...@gmail.com>.
So some quick feedback...

You mention maven is rather slow... It's taking me an average of 6
seconds for a command line 'mvn clean install' to build all 4 pom's.
I've got a MacBookPro (2013 model), 2.8 GHz Dual-Core Intel Core i7,
16GB Ram and SSD. I'm using Java 11.0.8 and Maven 3.6.3.

So debugging it within IntelliJ (Ultimate 2020.3 EAP version), I
loaded it as a Maven project. But simply running FileReadTestApp as an
Application and not via Maven, it was opening within 4-6 seconds... I
confirmed changes within JavaCommon were seen by FileReadTest, by
adding a System.out.println in the init method of UserPreferences, and
i saw the latest message i typed only seconds before in the console
output.

Regarding the gui builder you are using, not sure how to get that to
regenerate, but pure java code changes within IntelliJ are only taken
a matter of seconds for the latest changes to be seen and so used
within your app.

Installed NetBeans 12.1, it does feel very slow and sluggish. So
opening FileReadTestApp and selecting Run and it's taking 10-15
seconds before the maven output starts to appear then another 10-15
seconds before your gui appears, doing any changes to UserPreferences
are not picked up. Clicking Build with Dependencies, I'm seeing this;

No output for about 10 seconds
Maven takes about 10 seconds to build dependencies
No output for about 10 seconds
Maven takes about 10 seconds before exec and then another 5 seconds
and the gui appears.

So maybe use IntelliJ when editing java code and switch to NetBeans if
you need to change the gui...

John

On Wed, 21 Oct 2020 at 17:44, R. Diez <rd...@yahoo.de> wrote:
>
>
> First of all, thanks for your answer.
>
> I did not get your e-mail, I only saw your answer in the mailing list archive, so I hope the e-mail address I found for you somewhere else is the
> right one.
>
>
> > So execute [1] I believe is because you have checked "Build With
> > Dependencies" so it does a force rebuild of all projects
> > [...]
> > Why do you feel you need to do a forced rebuild? I'm sure NetBeans has
> > a compile on depend option. Did you have issues and then checking
> > "Build With Dependencies" fix that issue?
>
> That's correct. If I do not tick that option, then any changes to the common library JavaCommon are not recompiled. So I am not debugging the latest
> source code state.
>
> I have no custom plug-ins, code generation or anything fancy. NetBeans just does not rebuild dependencies automatically for Maven projects as far as I
> can tell. It is yet another reason to migrate away from NetBeans, but like I said, I cannot do it yet because the projects are using the NetBeans GUI
> builder (Matisse). 8-(
>
>
> > [...]
> > Maven can execute the same command line goals to all projects in a
> > single innovation, but it can't execute different command line goals
> > to different projects in a single innovation. So you might need to use
> > a profile or something and push the exec into that profile and then
> > run the profile. So after it does the build, it then does the exec.
>
> That sounds a little complicated, given my very limited experience with Maven.
>
>
> > Might sound a strange question but why do you have to use exec to run
> > your application. If it's loaded into NetBeans as a maven project can
> > you just run the main class manually instead of via exec?
>
> I do not actually know. Those steps are what NetBeans does by default when you create a new Maven project. I haven't figured out yet how NetBeans
> knows from the definition of such actions that a particular action wants to debug and not just build, so it should actually connect the debugger. If
> it is documented at all, I haven't found it yet.
>
> But yes, I gather that it should be possible to start the debugger on the build result without running Maven again. But NetBeans does not seem to
> offer the full flexibility to specify all command-line arguments to some executable. The whole reason why I am using an IDE like NetBeans is that I
> wanted to just point and click! O8-)
>
>
> > Do you have a branch I can look at with your maven build and I'll look
> > it at when free to see if i can spot anything obvious, or push you maven wip.
>
> Yes, sorry that I forgot to push the changes. I have done it now:
>
> https://sourceforge.net/p/filereadtest/code/ci/master/tree/
>
> Thanks in advance for your help,
>    rdiez

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Build with dependencies + debug in NetBeans in a single Maven invocation

Posted by "R. Diez" <rd...@yahoo.de.INVALID>.
First of all, thanks for your answer.

I did not get your e-mail, I only saw your answer in the mailing list archive, so I hope the e-mail address I found for you somewhere else is the 
right one.


> So execute [1] I believe is because you have checked "Build With
> Dependencies" so it does a force rebuild of all projects
> [...]
> Why do you feel you need to do a forced rebuild? I'm sure NetBeans has
> a compile on depend option. Did you have issues and then checking
> "Build With Dependencies" fix that issue?

That's correct. If I do not tick that option, then any changes to the common library JavaCommon are not recompiled. So I am not debugging the latest 
source code state.

I have no custom plug-ins, code generation or anything fancy. NetBeans just does not rebuild dependencies automatically for Maven projects as far as I 
can tell. It is yet another reason to migrate away from NetBeans, but like I said, I cannot do it yet because the projects are using the NetBeans GUI 
builder (Matisse). 8-(


> [...]
> Maven can execute the same command line goals to all projects in a
> single innovation, but it can't execute different command line goals
> to different projects in a single innovation. So you might need to use
> a profile or something and push the exec into that profile and then
> run the profile. So after it does the build, it then does the exec.

That sounds a little complicated, given my very limited experience with Maven.


> Might sound a strange question but why do you have to use exec to run
> your application. If it's loaded into NetBeans as a maven project can
> you just run the main class manually instead of via exec?

I do not actually know. Those steps are what NetBeans does by default when you create a new Maven project. I haven't figured out yet how NetBeans 
knows from the definition of such actions that a particular action wants to debug and not just build, so it should actually connect the debugger. If 
it is documented at all, I haven't found it yet.

But yes, I gather that it should be possible to start the debugger on the build result without running Maven again. But NetBeans does not seem to 
offer the full flexibility to specify all command-line arguments to some executable. The whole reason why I am using an IDE like NetBeans is that I 
wanted to just point and click! O8-)


> Do you have a branch I can look at with your maven build and I'll look
> it at when free to see if i can spot anything obvious, or push you maven wip.

Yes, sorry that I forgot to push the changes. I have done it now:

https://sourceforge.net/p/filereadtest/code/ci/master/tree/

Thanks in advance for your help,
   rdiez

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Build with dependencies + debug in NetBeans in a single Maven invocation

Posted by John Patrick <nh...@gmail.com>.
Going to be rusty on NetBeans specific bits as not used for maybe 10+
years because it was slow and bugging from memory, switched to Eclipse
and then IntelliJ and not looked back.

So execute [1] I believe is because you have checked "Build With
Dependencies" so it does a force rebuild of all projects and execute
[2] is running your application.

Why do you feel you need to do a forced rebuild? I'm sure NetBeans has
a compile on depend option. Did you have issues and then checking
"Build With Dependencies" fix that issue?

Do you have custom plugins or code generation running on your project
as that would be the only reason I would force a rebuild.

Maven can execute the same command line goals to all projects in a
single innovation, but it can't execute different command line goals
to different projects in a single innovation. So you might need to use
a profile or something and push the exec into that profile and then
run the profile. So after it does the build, it then does the exec.

Might sound a strange question but why do you have to use exec to run
your application. If it's loaded into NetBeans as a maven project can
you just run the main class manually instead of via exec?

If you were using IntelliJ you would just need to do the exec as
everything would have been rebuild automatically as required. The only
limitation is if you have plugins or some kind of code generation
which wouldn't have been execute. I would also just execute the main
class or what ever exec is doing instead of going via a maven wrapper
for exec.

Do you have a branch I can look at with your maven build and I'll look
it at when free to see if i can spot anything obvious, or push you
maven wip.

John







On Tue, 20 Oct 2020 at 00:37, R. Diez <rd...@yahoo.de.invalid> wrote:
>
> Hi all:
>
> I am migrating the following 2 Java applications and 1 "shared" library from NetBeans Ant-based projects to Maven:
>
> https://sourceforge.net/p/filereadtest/code/ci/master/tree/
>
> I have noticed that Maven is rather slow, which bugs me (I am very impatient for a part-time
> Java developer). I suspect the start-up costs are a big factor, and GraalVM is probably not
> quite ready yet to replace the standard JVM.
>
> When I am writing code, I want to press a key in order to immediately start the application
> under the debugger. All modified code, whether in the application or in the common library,
> should be recompiled (if necessary). This is standard in most development environments for
> most computer languages.
>
> So, after starting NetBeans, I went to the project settings, "Actions", "Debug project" and ticked "Build With Dependencies".
>
> I then noticed in the output window that Maven actually runs twice:
>
> 1) [...] mvn -DskipTests=true --also-make --projects QuickDiskTest install
>
> 2) [...] mvn [...] process-classes org.codehaus.mojo:exec-maven-plugin:1.5.0:exec
>
> Is there a way to run Maven just once? Or does Maven not support building and running (under a debugger) in a single invocation?
>
> Inside NetBeans, I could experiment with a new custom BuildWithDependenciesAndDebug action,
> but there does not seem to be a way to fully control the command-line arguments for an action. There are fields for goals, profiles and properties,
> but that is probably not enough. Or am I mistaken here?
>
> I am hoping that someone here could help me. I already posted this question in the NetBeans mailing list, but nobody answered:
>
> http://mail-archives.apache.org/mod_mbox/netbeans-users/202009.mbox/%3C1652543010.678234.1601497297309%40mail.yahoo.com%3E
>
> I cannot migrate this project away from NetBeans yet, because I am using the NetBeans GUI builder (Matisse) for the forms (see the .form files), which
> I guess is only available inside NetBeans.
>
> Thanks in advance,
>    rdiez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org