Where did the Apache Derby Eclipse plug-in go?

Solution 1:

Apache Derby db-derby-10.9.1.0-src / Eclipse 4.2.1 (Juno) / Java 7

Some kind of fix. Needs more research but this will work.

References:
db-derby-10.9.1.0-src/BUILDING.html
db-derby-10.8.1.2-src/plugins/eclipse/Readme.txt

Download the Apache Derby source zip.
Extract the zip.
Change to the source directory.
db-derby-10.9.1.0-src

Perform the following ant targets.
ant -quiet clobber
ant -quiet buildsource
ant -quiet buildjars

Build the core plugin.
ant plugin

You should now have a derby_core_plugin_10.9.1.zip file in the db-derby-10.9.1.0-src/jars/sane directory.

Note: Your Eclipse IDE should not be running. Extract the derby core plugin created by the ant plugin task above and copy the contents to your Eclipse plugins directory.

Run Eclipse.

Import the org.apache.derby.ui from the source tree.
(Import > General > Existing Projects into Workspace)

Open the plugin.xml file

On the Overview tab, bump up the version number to let's say 1.1.4.

Save the file.

The bug(s) are in ...
1.)package org.apache.derby.ui.popup.actions.AddDerbyNature.java
2.)package org.apache.derby.ui.popup.actions.RemoveDerbyNature.java

Where the .setStatus method are called in these two units.


Note: ( from the javadoc of ApplicationWindow )

void org.eclipse.jface.window.ApplicationWindow.setStatus(String message)

Sets or clears the message displayed in this window's status line (if it has >one). This method has no effect if the window does not have a status line.

Parameters:
message the status message, or null to clear it

So let's assume the IDE doesn't have a status line, so this call has no effect according to the Java doc.

Commenting out these method calls from:  
AddDerbyNature.java  
//((ApplicationWindow) window).setStatus(Messages.ADDING_NATURE);  
//((ApplicationWindow) window).setStatus(Messages.DERBY_NATURE_ADDED);  

RemoveDerbyNature.java  
//((ApplicationWindow)window).setStatus(Messages.REMOVING_NATURE);  
//((ApplicationWindow)window).setStatus(Messages.DERBY_NATURE_REMOVED);  

Test(s):
Run As Eclipse Application.

Create a project. Maybe call it “org.apache.derby.ui.test”.

Right Click on project / Select Add Apache Derby nature
No error.

Right Click on project / Select Remove Apache Derby nature
No error.

Add the nature again to test the other menu items.
Right Click on project / Select Add Apache Derby nature

Right Click on project / Select Start Derby Network Server
No error, server was started.

From the console log ... Sun Jan 27 17:51:29 EST 2013 : Security manager installed using the Basic server security policy. Sun Jan 27 17:51:29 EST 2013 : Apache Derby Network Server - 10.9.1.0 - (Unversioned directory) started and ready to accept connections on port 1527

Note: Not sure what the Unversioned directory message means

Right Click on project / Select Stop Derby Network Server
No error, server was stopped.
Sun Jan 27 17:53:32 EST 2013 : Apache Derby Network Server - 10.9.1.0 - (Unversioned directory) shutdown

Start the server back up …
Right Click on project / Select Start Derby Network Server

create a sql folder.
create a test.sql file

my test sql file.

connect 'jdbc:derby://localhost:1527/TESTDB;create=true;user=test;password=test;';  
-- drop User Indexes - ignore error if first time creating   
drop index UserNameIdx1;  
-- drop the table if it exists - ignore error if first time creating  
drop table TEST_USER;  
-- create the table  
create table TEST_USER (  
    ID integer generated by default as identity,  
    USER_NAME varchar(255) not null,  
    FIRST_NAME varchar(255),  
    LAST_NAME varchar(255),  
    PASSWORD varchar(255),  
    ENABLED integer,  
    CREATED_STAMP timestamp,  
    CREATED_TX_STAMP timestamp,  
    LAST_UPDATED_STAMP timestamp,  
    LAST_UPDATED_TX_STAMP timestamp,  
    constraint TEST_USER_PK primary key (ID)  
);  
-- insert some data -- oops --- will mess with the ID generator, see the alter table restart line below.  
insert into TEST_USER values(0, 'admin','admin','admin','admin',1,'2013-01-18 12:00:00.000','2013-01-18 12:00:00.000','2013-01-18 12:00:00.000','2013-01-18 12:00:00.000');  
-- make the USER_NAME unique  
create unique index UserNameIdx1 on TEST_USER(USER_NAME);  
-- reset the generator  
alter table TEST_USER alter column ID restart with 1;  

Right click on file > Apache Derby > Run SQL Script using 'ij'

Refesh the projects workspace, now there should be a TESTDB folder.

Database was created. Ok.

Create a zip.

Right click on project > Export

Click on Plug-in Development > Deplyable plug-ins and fragments.
Destination Tab
Archive file
/derby_ui_plugin_1.1.4-fix.zip
Options Tab
Unselect Package plugins as individual JAR archives

Click finish.

Close / Exit the test instance.
Exit Eclipse.

Extract the zip that you just created from above.

Copy it's contents to the plugins directory to your Eclipse (Juno) plugins directory.

Restart Eclipse. Create a new project.

You should be able to install an Apache Derby (10.9.1) nature onto your projects.

Note: if you built this with Java 7, don't expect it to work for any lesser JVM version.

Solution 2:

The Derby UI plugin for Eclipse has not been maintained for several years, I believe, as none of the regular Derby committers uses that plugin, and there have not been any volunteers from the community to maintain it. So I think it only works with older versions of Eclipse.

I suspect that it is not very much work to bring it up to date to make it work with current Eclipse. If you are interested in that functionality, I'm sure the Derby community would love to hear from you!

See also: Is it possible to use derby from apache in Eclipse now that they stopped developing the derby plugin for Eclipse?