Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-333

JAX-RS ApplicationConfig auto-generated addRestResourceClasses looses sub resources on mvn clean

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 8.2
    • None
    • webservices - REST
    • None

    Description

      I am experiencing a nasty intermittent bug where Netbeans removes sub resources in the auto-generated ApplicationConfig source. This happens intermittently and unpredictably when I clean or clean and build the project. It happens about 10% of the time. If I close Netbeans and reopen then it rescans the projects and adds the lines back. 

       

      E.g. normal state:

       

      @javax.ws.rs.ApplicationPath("/rest/v1")
      public class ApplicationConfig extends javax.ws.rs.core.Application {

      @Override
      public Set<Class<?>> getClasses()

      { Set<Class<?>> resources = new java.util.HashSet<>(); addRestResourceClasses(resources); return resources; }

      /**
      * Do not modify addRestResourceClasses() method.
      * It is automatically populated with
      * all resources defined in the project.
      * If required, comment out calling this method in getClasses().
      * @param resources Resource list
      */
      private void addRestResourceClasses(Set<Class<?>> resources) { resources.add(test.TemplateResource.class); resources.add(test.TemplatesResource.class); }

      }

      And then sometime after cleaning the project:

       

      @javax.ws.rs.ApplicationPath("/rest/v1")
      public class ApplicationConfig extends javax.ws.rs.core.Application {

      @Override
      public Set<Class<?>> getClasses() { Set<Class<?>> resources = new java.util.HashSet<>(); addRestResourceClasses(resources); return resources; }

      /**

      • Do not modify addRestResourceClasses() method.
      • It is automatically populated with
      • all resources defined in the project.
      • If required, comment out calling this method in getClasses().
      • @param resources Resource list
        */
        private void addRestResourceClasses(Set<Class<?>> resources) { resources.add(test.TemplatesResource.class); }

      }

      It never removes normal resources. Only sub resources are removed (ones with no @Path annotating the class)

       

      Assuming this would be very difficult to fix as its so unpredictable - Is there maybe a way I can disable the auto-changing of ApplicationConfig source 0 i.e. turn the feature off?

       

      Thanks

      Paul

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            paulcb Paul Carter-Brown
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: