Community
Participate
Working Groups
In the Java Persistence properties for a JPA project choose the JPA implementation type of User Library and select an appropriate library. Close and save the project properties. Right click on the library in the Project Explorer and choose 'Properties'. Select 'User Libraries...' and add/remove a jar from the user library. It can be any jar, doesn't have to be one that is needed for this library to be valid for the particular JPA platform. Now go back to the Project properties and view the Java Persistence page and you will see that the library has been unselected and there is an error. I can only get this to happen if I edit the library as described above. If you instead edit it through the Project properties 'Java Build Path' page, the JPA implementation library never gets unselected.
I'm not sure how this could be a Dali bug, so I'm going to set it to the library provider framework. Any ideas?
Reproduced the scenario and confirmed this as framework bug.
Taking another looks at this. This looks to be a bug in JDT UI. Editing User Library properties via entry on the project properties wipes classpath entry attributes. Repro for JDT UI: 1. Create a java project. 2. Create a user library called "mylib". 3. Add the following entry to .classpath file: <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/mylib"> <attributes> <attribute name="owner.project.facets" value="jpt.jpa"/> </attributes> </classpathentry> 4. Find library entry in package explorer. Right click -> mylib -> properties. 5. User Libraries... 6. Edit library content by adding another jar. 7. Close all dialogs. 8. Notice that classpath entry has been stripped of attributes: <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/mylib"/> Attributes are a critical facility for layered projects to extend JDT behavior.
Replace steps 5-8, with this: 5. Hit ok to close classpath container properties dialog without making any changes.
Created attachment 181441 [details] Patch v1 This patches UserLibraryWizardPage to preserve all of the information in the input classpath entry if the entry path doesn't change (user didn't select a different user library). There was already logic to preserve the setting of the export flag. I consolidated that logic with my changes. Testing the described scenario as well as other editing and creation scenarios. Can this patch be considered for inclusion into 3.7?
Markus, please take a look during M4.
That makes perfectly sense. Thanks a lot for the patch. Released to HEAD.