Conceptual question:

Supporting Ivy ways of doing things or use Ivy to do the NetBeans thing?

DK: I think the full integration should be "Ivy ways support plus NetBeans". If you create new NB project with Ivy support then anybody familiar with Ivy (on command line/notepad) should fine it straightforward to use/customize within NB. Thing is that NB UI will support just some common aspects and some (possible advanced) details will have to (or can) be configured in ivy config files by using NB XML editor with schema based CC.

Ivy ways support.

Editor support for Ivy files and Ivy settings files

  • add ivy schemas to catalog. -> schema based completion.
  • new file templates
  • build script code templates?
  • code completion for dependency ids can be done with ArtifactRepositoryNotes

Create a Library out of an Ivy file. Makes the opposite sense as well? Ship Ivy files for IDE's existing libraries as a new volume in library.

Trigger ivy dependencies download on project opening or Ivy files editing. Refresh classpath. How do we map ivy deps to classpath though? The download has to go through Ivy itself (no way to bypass actually, seems to be over configurable, best to ship ivy ant tasks and execute them from the IDE? will some context be lost?)

NetBeans ways support

There is a Ivy module for NetBeans

FaqIvy talks about usage without any special plugin.

Allow adding ivy dependencies in Libraries panel in customizer or in project Libraries subnodes. Automatically add relevant build script snippets then. Possibly suggest turning existing libraries or jars into ivy dependencies as well. This will require hardwiring some Ivy "configurations" (aka maven's scopes/profiles) to suit the "compile/runtime/testcompile/testruntime" classpaths in the IDE.

Will we be able to support existing or custom ivy setups?

  • preexisting means existing build script -> freeform?
  • how do we map our classpath to ivy configurations? (apart from our own "known" configurations)

There is another Ivy module for Netbeans

  • Works well in NB7.1
  • Requires launching of the "Resolve Dependencies" action once in the IDE before ant build can be used through the command-line. (Right Click On the Project and Select Ivy | Resolve)

Other Ide integration

Eclipse ivy integration

Existing projects using ivy

netbeans ivyfaq

"Cheap" IVY integration brainstorming

DK: Just a brainstorming on easiest way of integrating ivy to NetBeans - no attempt to provide general solution for integrating remote library repositories into NB; all APIs are just sketch to integrate ivy without any thought on their general usefulness and reusability

One solution which at the moment seems to me quite simple and which solves some of the issues you've raised is to integrate Ivy as library provider. Let me describe it from UI flow point of view:

In Library Manager you click New Library and you get UI asking for library type and name. First change would be to enhancement libraries API to allow library providers provide their own UI for library creation, eg:

public interface LibraryTypeProvider2 extends LibraryTypeProvider {
    NewLibraryCustomizer getNewLibraryCustomizer();

public interface NewLibraryCustomizer {
    JPanel getPanel();
    boolean isValid();
    boolean getName();
    Map<String, List<URI>> getContent();

The resulting new library UI would be: library type combo box + NewLibraryCustomizer.getPanel().

Ivy-module implementation of NewLibraryCustomizer would show remote repository browser and let user choose remote library.

Backward compatibility implementation of NewLibraryCustomizer asking for library name would exist and would be used if LibraryTypeProvider does not return its own one.

Back to new library UI. We selected ivy type and remote library browser is shown, we chose a remote library and it was downloaded to ivy local repository/cache, NB library was created with name corresponding to ivy's organization_module_revision, content of library points directly to ivy cache, corresponding NB library properties are added to userdir.properties, UI customizer of such a library is readonly and can show list of files, dependencies, configurations, etc.

Any library of ivy type can be added to any project usual way. If project is sharable then jars are copied to libraries folder and has to be put into VCS.

More desirable of course would be altering project's build script with ivy tasks downloading jars instead of storing them in VCS. That can be achieved via adding two more methods to above defined LibraryTypeProvider2:

interface LibraryTypeProvider2 extends LibraryTypeProvider {
    void libraryAddedToProject(LibraryImplementation l, Project p);
    void libraryRemovedFromProject(LibraryImplementation l, Project p);
    NewLibraryCustomizer getNewLibraryCustomizer();

Implementation for Ivy would update project.xml, ivy.xml, build scripts as needed. On the callers side project type would have to be updated to call this interface methods (via corresponding API methods in api.Library class).

For non-sharable projects Ivy-module would update build scripts just to download binaries to ivy cache. The ivy cache location is configured in NB Options. Ivy-module startup and/or configuration panel may check whether ivy cache is uptodate and may suggest downloading and possibly updating userdir.properties if location has changed or user deleted it etc. This may require enhancing library to have not only content and name but also some meta data which are stored along the library. Otherwise ivy-module has to guess everything from library name.

For sharable projects situation is not that different. Adding global ivy type library to sharable project results (as for any other library) into copying of library content (jar files form ivy cache) to sharable folder and creating entries in nblibraries.properties. In addition to that ivy would update build scripts to not only download jars to cache but to copy them from cache to the same place as defined in nblibraries.properties.

Re. Ivy configuration - possible solution could be in terms of NB libraries: map each ivy configuration to one NB library volume. In project's properties have "Ivy panel" with table with two columns: #1 ivy library used in project; #2 combo with library configurations. Choosing a configuration for library would on implementation layer meant libs.<ivy-type-lib>.classpath=libs.<ivy-type-lib>.<chosen-configuration>

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo