You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Mike Ryan <mr...@cornell.edu> on 2019/04/23 19:05:36 UTC

NB11 Java Web App with Gradle

I started a Java Web App back in NB 8.2 which by default used Ant.

Once I started using GitLab CI for the project, I created a build.gradle 
file, which just fires off the ant build:

ant.importBuild('build.xml') { antTargetName ->
     'a-' + antTargetName
}

and then defines my dependencies, war file info, etc.

Now that I'm using NB11, NB detects the build.gradle file and assumes 
this is a Gradle project. I'm fine with that, but obviously there are 
things I'm going to need to do to the structure of my 
project/build.gradle file to actually work with the project.

Specifically, my "Web Pages" directory no longer appears in the Project 
view. I presume this is because I need to adhere to Gradle's assumed 
location of the web or webapp directory or tell Gradle what that path is 
in my build.gradle, but I have been unable to figure out the settings to 
do this.

I've tried to use the info in Gradle docs, but I haven't been successful:

https://docs.gradle.org/current/userguide/war_plugin.html

I did notice that if you were to create a new project, "Java with 
Gradle" does not include "Web Application" as a project like "Java with 
Maven" and "Java with Ant -> Java Web" do.

I'm assuming that in NetBeans, I should be able to manually convert an 
existing Web App project to a Gradle Web App project?

If so, do I need to convert all the Ant stuff to Gradle? Or, at least in 
the short run is there a way to tell NB to ignore the existence of 
build.gradle and just let me open it up as an Ant Java Web App?

I have been Googling around and I haven't found anything obvious yet. If 
anyone knows of existing resources for figuring this out, please let me 
know.

Thanks!

-Mike

Re: NB11 Java Web App with Gradle

Posted by Mike Ryan <mr...@cornell.edu>.
Thanks so much, Juan. That was incredibly helpful.

In the short term I'm going to stick with NB 10, which has been working 
flawlessly for me.

Meanwhile, I'll see if there's some way I can help get this plugin into 
11.1 or 12 as Laszlo mentioned in that issue.

Best,

Mike

On 4/23/19 7:26 PM, Juan Algaba wrote:
> Hello Mike, I'm in a similar situation in that our project started
> (and still is) an ant-based java web project originally created with
> NB 8.2, but needed it to work with gradle as well, (not because of CI,
> but because a coworker prefers to use another editor that only
> supports Maven/Gradle).
> 
> We created a build.gradle on the root of the project for his
> convenience. When NB 11 came all we had to do was rename the
> build.gradle to something that NB doesn't recognize as a gradle
> project, say, "build.gradle.rename.me", and now the only thing our
> coworker has to do to get it working in his editor is rename the file
> back to build.gradle in his local working copy. You don't even need to
> delete the .gradle folder or change anything in the nbproject folder,
> as long as netbeans doesn't detect a gradle build file it will open
> your project as an ant project.
> 
> Now, in your case I see two alternatives:
> 1.- Keep the build.gradle and rename it on your local copy.
> 2.- Rename the build.gradle and somehow make your CI work with the renamed file.
> 
> Now regarding whether there's an option in NB11 to fix this without
> renaming anything, there's an option to prefer Maven over Gradle, but
> unfortunately not one to prefer Ant over Gradle.
> I don't recommend converting the project to gradle, since currently
> NB11 doesn't support web projects, please see this issue
> https://issues.apache.org/jira/browse/NETBEANS-2249 and more
> importantly Laszlo's comment regarding the status of this feature. By
> the way, Laszlo mentioned a plugin, but not sure if he's referring to
> this one http://plugins.netbeans.org/plugin/55529/gradle-javaee-support,
> I tried it and couldn't get it to work ¿Anyone else had any luck?
> 
> 
> 
> On Tue, Apr 23, 2019 at 12:14 PM Mike Ryan <mr...@cornell.edu> wrote:
>>
>> I started a Java Web App back in NB 8.2 which by default used Ant.
>>
>> Once I started using GitLab CI for the project, I created a build.gradle
>> file, which just fires off the ant build:
>>
>> ant.importBuild('build.xml') { antTargetName ->
>>       'a-' + antTargetName
>> }
>>
>> and then defines my dependencies, war file info, etc.
>>
>> Now that I'm using NB11, NB detects the build.gradle file and assumes
>> this is a Gradle project. I'm fine with that, but obviously there are
>> things I'm going to need to do to the structure of my
>> project/build.gradle file to actually work with the project.
>>
>> Specifically, my "Web Pages" directory no longer appears in the Project
>> view. I presume this is because I need to adhere to Gradle's assumed
>> location of the web or webapp directory or tell Gradle what that path is
>> in my build.gradle, but I have been unable to figure out the settings to
>> do this.
>>
>> I've tried to use the info in Gradle docs, but I haven't been successful:
>>
>> https://docs.gradle.org/current/userguide/war_plugin.html
>>
>> I did notice that if you were to create a new project, "Java with
>> Gradle" does not include "Web Application" as a project like "Java with
>> Maven" and "Java with Ant -> Java Web" do.
>>
>> I'm assuming that in NetBeans, I should be able to manually convert an
>> existing Web App project to a Gradle Web App project?
>>
>> If so, do I need to convert all the Ant stuff to Gradle? Or, at least in
>> the short run is there a way to tell NB to ignore the existence of
>> build.gradle and just let me open it up as an Ant Java Web App?
>>
>> I have been Googling around and I haven't found anything obvious yet. If
>> anyone knows of existing resources for figuring this out, please let me
>> know.
>>
>> Thanks!
>>
>> -Mike
> 
> 
> 

---------------------------------------------------------------------
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: NB11 Java Web App with Gradle

Posted by Juan Algaba <ja...@colef.mx>.
Hello Mike, I'm in a similar situation in that our project started
(and still is) an ant-based java web project originally created with
NB 8.2, but needed it to work with gradle as well, (not because of CI,
but because a coworker prefers to use another editor that only
supports Maven/Gradle).

We created a build.gradle on the root of the project for his
convenience. When NB 11 came all we had to do was rename the
build.gradle to something that NB doesn't recognize as a gradle
project, say, "build.gradle.rename.me", and now the only thing our
coworker has to do to get it working in his editor is rename the file
back to build.gradle in his local working copy. You don't even need to
delete the .gradle folder or change anything in the nbproject folder,
as long as netbeans doesn't detect a gradle build file it will open
your project as an ant project.

Now, in your case I see two alternatives:
1.- Keep the build.gradle and rename it on your local copy.
2.- Rename the build.gradle and somehow make your CI work with the renamed file.

Now regarding whether there's an option in NB11 to fix this without
renaming anything, there's an option to prefer Maven over Gradle, but
unfortunately not one to prefer Ant over Gradle.
I don't recommend converting the project to gradle, since currently
NB11 doesn't support web projects, please see this issue
https://issues.apache.org/jira/browse/NETBEANS-2249 and more
importantly Laszlo's comment regarding the status of this feature. By
the way, Laszlo mentioned a plugin, but not sure if he's referring to
this one http://plugins.netbeans.org/plugin/55529/gradle-javaee-support,
I tried it and couldn't get it to work ¿Anyone else had any luck?



On Tue, Apr 23, 2019 at 12:14 PM Mike Ryan <mr...@cornell.edu> wrote:
>
> I started a Java Web App back in NB 8.2 which by default used Ant.
>
> Once I started using GitLab CI for the project, I created a build.gradle
> file, which just fires off the ant build:
>
> ant.importBuild('build.xml') { antTargetName ->
>      'a-' + antTargetName
> }
>
> and then defines my dependencies, war file info, etc.
>
> Now that I'm using NB11, NB detects the build.gradle file and assumes
> this is a Gradle project. I'm fine with that, but obviously there are
> things I'm going to need to do to the structure of my
> project/build.gradle file to actually work with the project.
>
> Specifically, my "Web Pages" directory no longer appears in the Project
> view. I presume this is because I need to adhere to Gradle's assumed
> location of the web or webapp directory or tell Gradle what that path is
> in my build.gradle, but I have been unable to figure out the settings to
> do this.
>
> I've tried to use the info in Gradle docs, but I haven't been successful:
>
> https://docs.gradle.org/current/userguide/war_plugin.html
>
> I did notice that if you were to create a new project, "Java with
> Gradle" does not include "Web Application" as a project like "Java with
> Maven" and "Java with Ant -> Java Web" do.
>
> I'm assuming that in NetBeans, I should be able to manually convert an
> existing Web App project to a Gradle Web App project?
>
> If so, do I need to convert all the Ant stuff to Gradle? Or, at least in
> the short run is there a way to tell NB to ignore the existence of
> build.gradle and just let me open it up as an Ant Java Web App?
>
> I have been Googling around and I haven't found anything obvious yet. If
> anyone knows of existing resources for figuring this out, please let me
> know.
>
> Thanks!
>
> -Mike



-- 
 Juan Roberto Algaba Meave

---------------------------------------------------------------------
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