This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 250187 - Build Fails if MySQL JDBC driver library does not have default name
Summary: Build Fails if MySQL JDBC driver library does not have default name
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-03 17:02 UTC by MackSix
Modified: 2015-08-15 01:58 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
picture (31.17 KB, image/png)
2015-08-14 12:18 UTC, Tomas Zezula
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MackSix 2015-02-03 17:02:40 UTC
1. Goto Tools>>Libraries.
2. Click "New Library..."
3. Name the new library "MySQL Connector/J 5.1.34"
4. Add mysql-connector-java-5.1.34-bin.jar from some folder outside of NetBeans, like C:\Developer\lib\java\mysql-connector-java-5.1.34\
5. Add the library to a simple JSP project.
6. Try to build project.

Results:

C:\projects\JSP-JDBC-MySQLTest\nbproject\build-impl.xml:1007: Warning: Could not find file C:\projects\JSP-JDBC-MySQLTest\${libs.MySQL_Connector_J.classpath} to copy.
BUILD FAILED (total time: 0 seconds)

Workaround:

If the default library name "MySQL JDBC Driver" is used or the MySQL JDBC driver JAR is placed in /WEB-INF/lib/, there is no error.

Product Version: NetBeans IDE Dev (Build 201501290002)
Java: 1.8.0_31; Java HotSpot(TM) 64-Bit Server VM 25.31-b07
Runtime: Java(TM) SE Runtime Environment 1.8.0_31-b13
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 MackSix 2015-02-03 19:08:22 UTC
I removed the Library and re-created it and it works now with any name I name it. I am not sure what happened before. I did rename the library after creating it, but I can still do that now and it works fine. 

I will resolve this as WORKSFORME now.
Comment 2 MackSix 2015-02-03 20:50:13 UTC
I found out what caused it. Opening up the same project in another instance of NetBeans, without the custom MySQL JDBC library present, leaves the project uncompilable in the first instance, due to the error described in Comment 0.

Closing both NetBeans instances and then restarting the first one fixes the problem. 

I do not see this happen with other custom libraries that I add through the Ant Library Manager.
Comment 3 matthias42 2015-03-31 19:28:46 UTC
Reassigning to java/projects - this is what happens from my perspective:

The first instance of netbeans contains the definition of the libraries in <NB-Instance>/8.0/build.properties. The reference to this file is stored in <project>/nbproject/private/private.properties via user.properties.file.

It gets interesting when the project is opened with a second instance of netbeans. the private.properties file is the same, but the second instance writes different a different value for the property user.properties.file. Naturally the instance writes the path to its own build.properties.

Long story short: Opening the same j2se project with two different netbeans instances can't work.

From my perspective: I would not expect it to work so please evaluate whether this should be fixed or close the bug accordingly. Thank you!
Comment 4 Tomas Zezula 2015-08-14 09:23:12 UTC
Mathias is right and perfectly described what happens. Thanks.
The reason why the path to the build.properties is written to the private.properties is the command line build. The IDE can pass the path to build script when invoking ant but on command line you will need to specify the path every time you do a build. So the path is written to private properties. Opening the project in 2 IDEs is not supported.

I can improve the situation by passing the path to build.properties when IDE calls the ant in addition to writing it to the private.properties. This will fix the build from the IDE (the second IDE will not break the first IDE build) but it will not work from the command line as on command line the value is taken from private.properties unless you specify different one as Ant -D option, which noone does.
Probably some notification like:

The project {0} uses other NetBeans instance build.properties.
[Run anyway] [Run with this NB] [Update build.properties reference]


[Run anyway] - just runs the ant script
[Run with this NB] - passes the path to build.properties to ant script.
[Update build.properties reference] - updates the project private.properties to the path to build.properties

I will try
Comment 5 Tomas Zezula 2015-08-14 12:17:52 UTC
Fixed jet-main 324a65a44b4c

The dialog is not very nice but works fine, see attached picture.
If someone comes with better message, button names I will change them.
Comment 6 Tomas Zezula 2015-08-14 12:18:23 UTC
Created attachment 155347 [details]
picture
Comment 7 Quality Engineering 2015-08-15 01:58:25 UTC
Integrated into 'main-silver', will be available in build *201508150002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/324a65a44b4c
User: Tomas Zezula <tzezula@netbeans.org>
Log: #250187:Build Fails if MySQL JDBC driver library does not have default name