You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Chris McGee <cm...@macadamian.com> on 2018/08/22 11:43:03 UTC

[java] formatter questions

Hi All,

I am interested in using the new NetBeans 9.0 for a new project that I’m working on since it looks like there are some nice improvements over 8.2. It’s good to see active development on this project.

One problem that I ran into right away is that the eclipse 4 formatter module is not yet compatible. I am using it because it allows me to share the same format configuration between NetBeans and a Maven formatter plugin that uses the eclipse formatter.

Does anyone know if the eclipse formatter module will adopt NB 9 in the near future? Otherwise, is there another way to use the netbeans formatter and share its options with a maven plugin to format the code?

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

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


Re: [java] formatter questions

Posted by Josh Juneau <ju...@gmail.com>.
Hi Chris,

Looking at the github site for the Eclipse Java Code Formatter plugin...it
looks like they are wanting some assistance maintaining.  To that end, I'd
recommend making a fork and patching it to get it working with NetBeans 9.

https://github.com/markiewb/eclipsecodeformatter_for_netbeans


Hope this helps...thanks.

On Wed, Aug 22, 2018 at 7:03 AM Chris McGee <cm...@macadamian.com> wrote:

>
> Hi All,
>>
>> I am interested in using the new NetBeans 9.0 for a new project that I’m
>> working on since it looks like there are some nice improvements over 8.2.
>> It’s good to see active development on this project.
>>
>> One problem that I ran into right away is that the eclipse 4 formatter
>> module is not yet compatible.
>
>
>
> What do you mean by that, in what way is it not compatible, where are you
> getting it from, where is the source code.
>
>
> When I installed NB 8.2 I found the plugin in the plugin marketplace. It’s
> called “Eclipse Java Code Formatter.” After importing my settings into NB
> 9.0 I was prompted to install newer versions of certain plugins so that
> they are compatible, however the formatter is listed as having no
> compatible versions available.
>
> Perhaps there is a different marketplace that I can use to get it with NB
> 9.0? I could compile it myself and patch, but then it is more difficult to
> get my team on board with it.
>
>
> Thanks,
>
> Gj
>
>
> --
Josh Juneau
juneau001@gmail.com
http://jj-blogger.blogspot.com
https://www.apress.com/index.php/author/author/view/id/1866

Re: [java] formatter questions

Posted by Chris McGee <cm...@macadamian.com>.
Sorry, I meant that the eclipse formatter plugin is looking for maintainers. If it’s helpful I’ll try to describe the problem that we are facing.

The development team has a standard IDE, NetBeans, but everyone is free to use the tools that they are most comfortable. We have already established certain Java code formatting settings in NetBeans and shared that configuration using the project settings (nb-configuration.xml) checked into source control. However, if a developer is using another IDE or editor (e.g. eclipse, vim) to modify the Java files it is possible that they check-in files that don’t follow the standard format.

Sometimes, this is caught in code review, but not everyone checks the indentation very carefully. It would be good if the continuous integration build would catch bad formatting. It would be great if there was a Maven command that they could run either before checking-in (ideal) or after the continuous integration build fails.

Most Maven formatter plugins that I have seen have standardized on the eclipse java formatter settings and often bundle the eclipse formatter code itself to perform the formatting. It is quite a painstaking process trying to map NetBeans formatter settings to the eclipse formatter. We don’t want a NetBeans user using the standard setup to get tripped up by the formatter process since they are following the standard setup, which is meant to be streamlined. The easiest way to guarantee this is to have both the Maven formatter and NetBeans use the same formatter code and settings.

Cheers,
Chris

> 
> No, it’s not abandoned. I’m sure there are many, me included, very interested in developing it further, if you’ll help out by explaining what the problem is.
> 
> Gj


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

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


Re: [java] formatter questions

Posted by Geertjan Wielenga <ge...@oracle.com>.
No, it’s not abandoned. I’m sure there are many, me included, very interested in developing it further, if you’ll help out by explaining what the problem is.

Gj

Sent from my iPhone

> On 22 Aug 2018, at 14:53, Chris McGee <cm...@macadamian.com> wrote:
> 
> Thanks everyone for the suggestions.
> 
> I’ll give it some thought as to whether we want to continue to use the abandoned code formatter or rely on developer diligence to keep the code base formatted correctly.
> 
> If we were to invest time into this problem I wonder if it would be better to make the NB java formatter into a maven plugin that could format and/or check the code with the project’s settings. I’m not sure how difficult that would be.
> 
> Cheers,
> Chris
> 
>> On Aug 22, 2018, at 8:24 AM, Geertjan Wielenga <ge...@googlemail.com.INVALID> wrote:
>> 
>> I would suggest to not import setting from 8.2. Instead, start 9.0 fresh and empty, register the 8.2 update center, and then pick that specific formatter plugin and try to install it:
>> 
>> https://blogs.apache.org/netbeans/entry/what-s-happened-to-my
>> 
>> After that, the errors you'll see will be specific to you having installed the plugin into 9.0. Then report that in the issue tracker (https://github.com/markiewb/eclipsecodeformatter_for_netbeans/issues) and probably it could be resolved as easily as opening the sources of the formatter and compiling them in 9.0.
>> 
>> Gj
>> 
>> 
>> 
>>> On Wed, Aug 22, 2018 at 2:18 PM, Chris McGee <cm...@macadamian.com> wrote:
>>> 
>>>> You're going to need to be very detailed, otherwise no one can help you. What are the 'certain plugins' you're referring to?
>>> 
>>> Sure thing.
>>> 
>>> Here are the steps:
>>> 1) Launch NetBeans 8.2
>>> 2) Tools -> Plugins -> Available Plugins
>>> 3) Search for “Eclipse Java Formatter”
>>> 4) Pick “Eclipse Java Formatter (4.6…”
>>> 5) Click “Install”
>>> 6) Install NetBeans 9.0
>>> 7) Run NetBeans 9.0
>>> 8) When prompted, import settings from 8.2
>>> 9) A dialog opens indicating that some of the plugins must be migrated to newer versions to work with NB 9.0
>>> 
>>> The formatter plugin is in the bottom panel indicating that it is not compatible and there is no known compatible version.
>>> 
>>> It seems that eclipse formatting is a third-party plugin. Is there a better and more supported way to share the formatting options with command-line or maven formatters? My team mates are using their own tools sometimes and bad formatting gets checked-in to source control. It would be good to have it caught by the CI build.
>>> 
>>> Thanks,
>>> Chris
>> 
> 

Re: [java] formatter questions

Posted by Chris McGee <cm...@macadamian.com>.
Thanks Geertjan,

It seems like we should standardize on the Eclipse formatter so that we can use this plugin and the the maven one. Now the trick will be to convert the netbeans settings into the Eclipse equivalents.

Cheers,
Chris

> On Aug 27, 2018, at 2:53 AM, Geertjan Wielenga <ge...@googlemail.com.INVALID> wrote:
> 
> Here's the PR to enable the plugin to work on Apache NetBeans (incubating) 9.0:
> 
> https://github.com/markiewb/eclipsecodeformatter_for_netbeans/pull/97 <https://github.com/markiewb/eclipsecodeformatter_for_netbeans/pull/97>
> 
> Really minor tweaks, to be honest.
> 
> Gj
> 
> 
> 
> On Thu, Aug 23, 2018 at 12:42 PM, Chris McGee <cmcgee@macadamian.com <ma...@macadamian.com>> wrote:
> Thanks Will,
> 
> I’ll go over this with the team. You’re probably right that making this third party plugin work with NB 9.0 and future is likely not a large investment.
> 
> I’m wondering if that investment is better spent finding a way to invoke the NB formatter(s) in Maven. This would be ideal for us as our code is already mostly formatted using NB with well known settings for Java, JSP, HTML and Javascript. I don’t know the NB formatter code at all yet and so I don’t know how difficult that would be. Also, it is unclear if other teams have the same problem and how many would benefit from such a tool.
> 
> Any thoughts on this approach?
> 
> Cheers,
> Chris
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org <ma...@netbeans.apache.org>
> For additional commands, e-mail: users-help@netbeans.apache.org <ma...@netbeans.apache.org>
> 
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
> 
> 


Re: [java] formatter questions

Posted by Geertjan Wielenga <ge...@googlemail.com.INVALID>.
Here's the PR to enable the plugin to work on Apache NetBeans (incubating)
9.0:

https://github.com/markiewb/eclipsecodeformatter_for_netbeans/pull/97

Really minor tweaks, to be honest.

Gj



On Thu, Aug 23, 2018 at 12:42 PM, Chris McGee <cm...@macadamian.com> wrote:

> Thanks Will,
>
> I’ll go over this with the team. You’re probably right that making this
> third party plugin work with NB 9.0 and future is likely not a large
> investment.
>
> I’m wondering if that investment is better spent finding a way to invoke
> the NB formatter(s) in Maven. This would be ideal for us as our code is
> already mostly formatted using NB with well known settings for Java, JSP,
> HTML and Javascript. I don’t know the NB formatter code at all yet and so I
> don’t know how difficult that would be. Also, it is unclear if other teams
> have the same problem and how many would benefit from such a tool.
>
> Any thoughts on this approach?
>
> Cheers,
> Chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>

Re: [java] formatter questions

Posted by Chris McGee <cm...@macadamian.com>.
Thanks Will,

I’ll go over this with the team. You’re probably right that making this third party plugin work with NB 9.0 and future is likely not a large investment.

I’m wondering if that investment is better spent finding a way to invoke the NB formatter(s) in Maven. This would be ideal for us as our code is already mostly formatted using NB with well known settings for Java, JSP, HTML and Javascript. I don’t know the NB formatter code at all yet and so I don’t know how difficult that would be. Also, it is unclear if other teams have the same problem and how many would benefit from such a tool.

Any thoughts on this approach?

Cheers,
Chris

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

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


Re: [java] formatter questions

Posted by Will Hartung <wi...@gmail.com>.
On Wed, Aug 22, 2018 at 5:53 AM, Chris McGee <cm...@macadamian.com> wrote:

> I’ll give it some thought as to whether we want to continue to use the
> abandoned code formatter or rely on developer diligence to keep the code
> base formatted correctly.
>

The point is that odds are very high that whatever is making this plugin
incompatible is most likely some little bit of meta data. The code is the
code, NB Platform, in general, is more stable than not.

Even a developer new to the platform could probably build this add on,
tweak it to make it compatible, and bring it up to date quite quickly. I
mean, who knows, right? Maybe, maybe not.

Were someone on your team to do that, and submit the patch back to the
original developer, then, tada the module is now "maintained". For maybe a
couple hours work, until the next release of NB.

Considering the time savings and other value you gain from using this
plugin, don't you think it might be worth an hour or two to at least have
someone take a serious look at it?

Check it out, build it, take a look at it. If you have problems, folks here
may be able to give detailed tips on getting the plugin to work again. They
can readily help with the NB parts. The eclipse part, not so much, right?
And this is likely a NB issue, not an eclipse formatter thing.

AT WORST, you have a fork of this module now working for you, and you have
an internal website somewhere hosting the fork artifact so it's available
to your users as a module (this entails an XML file and your module, it's
no big deal). Not the most egregious burden. Ideally, the author will
incorporate your change and its now "up to date", just as it always has
been.

So, in total, the ask here isn't that great.

What do you think?

Regards,

Will Hartung

Re: [java] formatter questions

Posted by Chris McGee <cm...@macadamian.com>.
Thanks everyone for the suggestions.

I’ll give it some thought as to whether we want to continue to use the abandoned code formatter or rely on developer diligence to keep the code base formatted correctly.

If we were to invest time into this problem I wonder if it would be better to make the NB java formatter into a maven plugin that could format and/or check the code with the project’s settings. I’m not sure how difficult that would be.

Cheers,
Chris

> On Aug 22, 2018, at 8:24 AM, Geertjan Wielenga <ge...@googlemail.com.INVALID> wrote:
> 
> I would suggest to not import setting from 8.2. Instead, start 9.0 fresh and empty, register the 8.2 update center, and then pick that specific formatter plugin and try to install it:
> 
> https://blogs.apache.org/netbeans/entry/what-s-happened-to-my <https://blogs.apache.org/netbeans/entry/what-s-happened-to-my>
> 
> After that, the errors you'll see will be specific to you having installed the plugin into 9.0. Then report that in the issue tracker (https://github.com/markiewb/eclipsecodeformatter_for_netbeans/issues <https://github.com/markiewb/eclipsecodeformatter_for_netbeans/issues>) and probably it could be resolved as easily as opening the sources of the formatter and compiling them in 9.0.
> 
> Gj
> 
> 
> 
> On Wed, Aug 22, 2018 at 2:18 PM, Chris McGee <cmcgee@macadamian.com <ma...@macadamian.com>> wrote:
> 
>> You're going to need to be very detailed, otherwise no one can help you. What are the 'certain plugins' you're referring to?
> 
> Sure thing.
> 
> Here are the steps:
> 1) Launch NetBeans 8.2
> 2) Tools -> Plugins -> Available Plugins
> 3) Search for “Eclipse Java Formatter”
> 4) Pick “Eclipse Java Formatter (4.6…”
> 5) Click “Install”
> 6) Install NetBeans 9.0
> 7) Run NetBeans 9.0
> 8) When prompted, import settings from 8.2
> 9) A dialog opens indicating that some of the plugins must be migrated to newer versions to work with NB 9.0
> 
> The formatter plugin is in the bottom panel indicating that it is not compatible and there is no known compatible version.
> 
> It seems that eclipse formatting is a third-party plugin. Is there a better and more supported way to share the formatting options with command-line or maven formatters? My team mates are using their own tools sometimes and bad formatting gets checked-in to source control. It would be good to have it caught by the CI build.
> 
> Thanks,
> Chris
> 


Re: [java] formatter questions

Posted by Geertjan Wielenga <ge...@googlemail.com.INVALID>.
I would suggest to not import setting from 8.2. Instead, start 9.0 fresh
and empty, register the 8.2 update center, and then pick that specific
formatter plugin and try to install it:

https://blogs.apache.org/netbeans/entry/what-s-happened-to-my

After that, the errors you'll see will be specific to you having installed
the plugin into 9.0. Then report that in the issue tracker (
https://github.com/markiewb/eclipsecodeformatter_for_netbeans/issues) and
probably it could be resolved as easily as opening the sources of the
formatter and compiling them in 9.0.

Gj



On Wed, Aug 22, 2018 at 2:18 PM, Chris McGee <cm...@macadamian.com> wrote:

>
> You're going to need to be very detailed, otherwise no one can help you.
> What are the 'certain plugins' you're referring to?
>
>
> Sure thing.
>
> Here are the steps:
> 1) Launch NetBeans 8.2
> 2) Tools -> Plugins -> Available Plugins
> 3) Search for “Eclipse Java Formatter”
> 4) Pick “Eclipse Java Formatter (4.6…”
> 5) Click “Install”
> 6) Install NetBeans 9.0
> 7) Run NetBeans 9.0
> 8) When prompted, import settings from 8.2
> 9) A dialog opens indicating that some of the plugins must be migrated to
> newer versions to work with NB 9.0
>
> The formatter plugin is in the bottom panel indicating that it is not
> compatible and there is no known compatible version.
>
> It seems that eclipse formatting is a third-party plugin. Is there a
> better and more supported way to share the formatting options with
> command-line or maven formatters? My team mates are using their own tools
> sometimes and bad formatting gets checked-in to source control. It would be
> good to have it caught by the CI build.
>
> Thanks,
> Chris
>

Re: [java] formatter questions

Posted by Chris McGee <cm...@macadamian.com>.
> You're going to need to be very detailed, otherwise no one can help you. What are the 'certain plugins' you're referring to?

Sure thing.

Here are the steps:
1) Launch NetBeans 8.2
2) Tools -> Plugins -> Available Plugins
3) Search for “Eclipse Java Formatter”
4) Pick “Eclipse Java Formatter (4.6…”
5) Click “Install”
6) Install NetBeans 9.0
7) Run NetBeans 9.0
8) When prompted, import settings from 8.2
9) A dialog opens indicating that some of the plugins must be migrated to newer versions to work with NB 9.0

The formatter plugin is in the bottom panel indicating that it is not compatible and there is no known compatible version.

It seems that eclipse formatting is a third-party plugin. Is there a better and more supported way to share the formatting options with command-line or maven formatters? My team mates are using their own tools sometimes and bad formatting gets checked-in to source control. It would be good to have it caught by the CI build.

Thanks,
Chris

Re: [java] formatter questions

Posted by Geertjan Wielenga <ge...@googlemail.com.INVALID>.
On Wed, Aug 22, 2018 at 2:03 PM, Chris McGee <cm...@macadamian.com> wrote:

>
> Hi All,
>>
>> I am interested in using the new NetBeans 9.0 for a new project that I’m
>> working on since it looks like there are some nice improvements over 8.2.
>> It’s good to see active development on this project.
>>
>> One problem that I ran into right away is that the eclipse 4 formatter
>> module is not yet compatible.
>
>
>
> What do you mean by that, in what way is it not compatible, where are you
> getting it from, where is the source code.
>
>
> When I installed NB 8.2 I found the plugin in the plugin marketplace. It’s
> called “Eclipse Java Code Formatter.” After importing my settings into NB
> 9.0 I was prompted to install newer versions of certain plugins
>



You're going to need to be very detailed, otherwise no one can help you.
What are the 'certain plugins' you're referring to?

Here's the Plugin Portal: http://plugins.netbeans.org/

I suppose the source code of the plugin is this one:

https://github.com/markiewb/eclipsecodeformatter_for_netbeans

I suppose you're working with the most recent release, listed here:

https://github.com/markiewb/eclipsecodeformatter_for_netbeans/releases

That should get you further. Maybe you should file an issue (with very
detailed information there):

https://github.com/markiewb/eclipsecodeformatter_for_netbeans/issues

Gj



> so that they are compatible, however the formatter is listed as having no
> compatible versions available.
>
> Perhaps there is a different marketplace that I can use to get it with NB
> 9.0? I could compile it myself and patch, but then it is more difficult to
> get my team on board with it.
>
>
> Thanks,
>
> Gj
>
>
>

Re: [java] formatter questions

Posted by John McDonnell <mc...@gmail.com>.
Hi,

try installing it and seeing if it works.

If you run into any issues report them against
https://github.com/markiewb/eclipsecodeformatter_for_netbeans

Regards

John

On Wed, 22 Aug 2018 at 13:03, Chris McGee <cm...@macadamian.com> wrote:

>
> Hi All,
>>
>> I am interested in using the new NetBeans 9.0 for a new project that I’m
>> working on since it looks like there are some nice improvements over 8.2.
>> It’s good to see active development on this project.
>>
>> One problem that I ran into right away is that the eclipse 4 formatter
>> module is not yet compatible.
>
>
>
> What do you mean by that, in what way is it not compatible, where are you
> getting it from, where is the source code.
>
>
> When I installed NB 8.2 I found the plugin in the plugin marketplace. It’s
> called “Eclipse Java Code Formatter.” After importing my settings into NB
> 9.0 I was prompted to install newer versions of certain plugins so that
> they are compatible, however the formatter is listed as having no
> compatible versions available.
>
> Perhaps there is a different marketplace that I can use to get it with NB
> 9.0? I could compile it myself and patch, but then it is more difficult to
> get my team on board with it.
>
>
> Thanks,
>
> Gj
>
>
>

Re: [java] formatter questions

Posted by Chris McGee <cm...@macadamian.com>.
> Hi All,
> 
> I am interested in using the new NetBeans 9.0 for a new project that I’m working on since it looks like there are some nice improvements over 8.2. It’s good to see active development on this project.
> 
> One problem that I ran into right away is that the eclipse 4 formatter module is not yet compatible.
>  
> 
> What do you mean by that, in what way is it not compatible, where are you getting it from, where is the source code.

When I installed NB 8.2 I found the plugin in the plugin marketplace. It’s called “Eclipse Java Code Formatter.” After importing my settings into NB 9.0 I was prompted to install newer versions of certain plugins so that they are compatible, however the formatter is listed as having no compatible versions available.

Perhaps there is a different marketplace that I can use to get it with NB 9.0? I could compile it myself and patch, but then it is more difficult to get my team on board with it.

> 
> Thanks,
> 
> Gj
> 


Re: [java] formatter questions

Posted by Geertjan Wielenga <ge...@googlemail.com.INVALID>.
On Wed, Aug 22, 2018 at 1:43 PM, Chris McGee <cm...@macadamian.com> wrote:

> Hi All,
>
> I am interested in using the new NetBeans 9.0 for a new project that I’m
> working on since it looks like there are some nice improvements over 8.2.
> It’s good to see active development on this project.
>
> One problem that I ran into right away is that the eclipse 4 formatter
> module is not yet compatible.



What do you mean by that, in what way is it not compatible, where are you
getting it from, where is the source code.

Thanks,

Gj






> I am using it because it allows me to share the same format configuration
> between NetBeans and a Maven formatter plugin that uses the eclipse
> formatter.
>
> Does anyone know if the eclipse formatter module will adopt NB 9 in the
> near future? Otherwise, is there another way to use the netbeans formatter
> and share its options with a maven plugin to format the code?
>
> Thanks,
> Chris
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>