netbeans-gradle-project

This project is a NetBeans plugin able to open Gradle based Java projects. The implementation is based on Geertjan Wielenga's plugin.

  • 所有者: kelemen/netbeans-gradle-project
  • 平台:
  • 许可证:
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Current changes

The release notes for all versions (since 1.1.1) can now be viewed in the release-notes directory.
Also, there is a list of changes applied but not yet released in
not-released-changes.md.

Downloads

The latest release can be downloaded from
http://plugins.netbeans.org/plugin/44510/gradle-support and is also
available via the Update Center (Tools/Plugins: Look for "Gradle Support").

JDK 6: If you are using NetBeans with JDK 6, the last version of the plugin compatible with Java 6 is 1.3.0. Note: You will still be able to open Java 6 based projects (even Java 5). The limitation applies only for the JDK used to start NetBeans.

General Description

This project is a NetBeans plugin able to open Gradle based Java projects.
The implementation is based on Geertjan Wielenga's plugin.
You can open a folder as a project in NetBeans like with any other project and
start editing the code without actually generating any other NetBeans project files.

About J2EE projects: This plugin sees web projects as simple J2SE projects with an additional "webapp" directory, so many
features related to web projects will be disabled in Gradle projects. Hildo's
Gradle JavaEE Support might be installed for better support.

You can read more about the plugin on the wiki pages.

Troubleshooting

I have updated the plugin and now cannot load projects

You may see an exception like this: FileNotFoundException: JAR entry XXX.class not found in YYY\gradle-tooling-api.jar.
This happens because the Gradle daemon caches some jars and some of them might change when updating. The issue can be
reproduced using Gradle 1.8 and above when using the new API to load a project (can be adjusted in the global settings).

To fix this, you have to kill the Gradle daemon (a java process) and reload the project.

LinkageError: "loader constraint violation", debugging does not work

Attempting to use Gradle 1.8 will break debugging functionality in NetBeans (not only for Gradle projects). The workaround is not to use Gradle 1.8: Specify another version to load the Gradle project in the project properties. Note that once you have loaded a Gradle 1.8 project, you have to restart NetBeans to fix debugging features.

The issue in Gradle is fixed in Gradle 1.9-rc-1. However, when using nightly builds, you have to use 1.10-20131011231056+0000 or later.

Read issue #74 for details.

NetBeans hangs while starting

In version 1.1.7 there is a known issue which might cause a dead-lock in NetBeans.
It is fixed in 1.1.8 but to be able to upgrade you will need to
disable the currently installed one manually.

The classpaths are wrong within NetBeans

This plugin loads an IdeaProject
instance from the build script and therefore configurations applied to the
Idea plugin (apply plugin: 'idea')
will be detected by the NetBeans plugin as well.

Therefore you can add code to the build script to manually edit the classpath:

idea {
  module {
    scopes.COMPILE.plus += configurations.myconfig;
  }
}

The above code adds the dependencies of the "myconfig" configuration to the compile time classpath
of the subproject. Don't forget to call apply plugin: 'idea' before the above code can be applied.

How can I configure the provided dependency scope?

Gradle does not yet have a concept of provided dependencies in the Java plugin (it does have
in the War plugin).
Most developers solve this by adding a user defined configuration like this:

configurations {
  provided
}

Then after adding the dependencies, adjusts the classpaths:

sourceSets {
  main {
    compileClasspath = compileClasspath + configurations.provided;
  }
}

This way Gradle will be able to compile the sources. However, the NetBeans plugin
is ignorant of user defined configurations and therefore to make the project load
properly in NetBeans, you will need to append the following code to the build script:

idea {
  module {
    scopes.PROVIDED.plus += configurations.provided;
  }
}

In version "1.1.3" or below, the above code should be

idea {
  module {
    scopes.COMPILE.plus += configurations.provided;
  }
}

because the NetBeans plugin did not expect provided dependencies.
Note however that in both cases provided dependencies will be listed
amongst the compile time dependencies within NetBeans.

NetBeans seems to load projects without asking

Most likely you have a project with more than 100 subprojects (including the root).
To avoid unnecessary loading of projects you should increase the number of projects
to be cached. This can be changed on the Tools/Options/Miscellaneous/Gradle panel.

Loading the project takes too long

There can be several causes for this problem:

  • On the first project load, Gradle will download every
    dependency and this may take quite a lot of time if you have lots
    of dependencies.
  • If loading the project waits on "Load projects" then chances are that
    the gradle daemon got corrupted. You should delete the "daemon" directory
    in the ".gradle" directory of your home directory (System.getProperty("user.home")).
    If it does not help, remove the entire ".gradle" directory (note that this will also
    remove your local artifact cache).
  • If loading the project waits while trying to retrieving the dependency of a project,
    you might need to configure the proxy settings in NetBeans.

Cannot load a project: The error message says that the Gradle daemon gave up after 100 attempts

The Gradle daemon got corrupted. You should delete the "daemon" directory in the ".gradle"
directory of your home directory (System.getProperty("user.home")). If it does not help,
remove the entire ".gradle" directory (note that this will also remove your local
artifact cache).

How can I speed up the project opening?

The only thing you can do is to specify the installation directory of Gradle.
This can be done on the Tools/Options/Miscellaneous/Gradle panel. This way
you can even jump to the Gradle source code from a Gradle script (using ctrl + click).

I do not have a build.gradle file for every project. How can I open these projects?

Open the parent project of the project you want to open. Once you have opened the parent project,
you may right click on any of its child projects and open it even if it does not have
a build.gradle.

Note however, that I recommend to have a build.gradle file for every project
(even if empty) you might want to open because even if you open projects without
a build.gradle, these opened projects will not be opened the next time you
start NetBeans.

I have a build.gradle file in a directory but NetBeans does not recognizes it as a project

Gradle projects found in the temporary directory cannot be opened for techincal reasons.
Move these projects from the temporary directory.

Classes of the Gradle API are not recognized by the editor

I know of this problem but it seems that it is not possible (with reasonable effort)
to solve this without a new NetBeans API. Don't despair, there is a hope that this change
might get added (note however that this may not be trivial to add to NetBeans).

I get the error: "Cannot rename file settings.gradle in XXXX to build.gradle"

You might have an old Gradle plugin installed and it seems that they cannot co-exists.
Remove the old plugin. See Issue #4
for further information.

Gradle files get renamed to build.gradle

The same as the previous issue:

You might have an old Gradle plugin installed and it seems that they cannot co-exists.
Remove the old plugin. See Issue #4
for further information.

Current Limitations

  • It is not possible to directly open projects without a build.gradle.
    To open such projects, open its parent project and find the project to
    be opened in the SubProjects node, then right click/"Open Subproject".
  • The character encoding for the source file is not read from the Gradle
    script but can be set separately in project properties (stored with the
    settings.gradle in .nb-gradle-properties).
  • It is not detected automatically when the project needs to be reloaded.
    The "Reload Project" action must be executed manually (from the project's
    popup menu). No automatic detection is done because reloading the project is
    slow (just like opening it).

主要指标

概览
名称与所有者kelemen/netbeans-gradle-project
主编程语言Java
编程语言Java (语言数: 3)
平台
许可证
所有者活动
创建于2012-08-03 23:41:43
推送于2019-02-03 20:40:02
最后一次提交2019-02-03 21:39:41
发布数56
最新版本名称v2.0.2 (发布于 )
第一版名称v1.0.0 (发布于 )
用户参与
星数169
关注者数33
派生数57
提交数2.9k
已启用问题?
问题数393
打开的问题数99
拉请求数26
打开的拉请求数0
关闭的拉请求数18
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?