Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7675

Extra dot required when specifying base packages to scan in Java2Wadl Maven plugins

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.2
    • 3.2.3, 3.2.4
    • JAX-RS
    • Unknown

    Description

      <plugin>
          <groupId>org.apache.cxf</groupId>
          <artifactId>cxf-java2wadl-plugin</artifactId>
          <version>3.2.2</version>
          <executions>
              <execution>
                  <id>generate-wadl</id>
                  <goals>
                      <goal>java2wadl</goal>
                  </goals>
                  <phase>process-classes</phase>
              </execution>
          </executions>
          <configuration>
              <attachWadl>true</attachWadl>
              <classResourceNames />
              <outputFileName>${project.artifactId}</outputFileName>
              <!-- NOTE: terminate packages with dots otherwise scanning yields nothing -->
              <basePackages>com.cb4.base.rest.,com.cb4.cretail.rest.,com.cb4.cpatterns.rest.</basePackages>
          </configuration>
      </plugin>
      

      this is due to the following code:
       

      org.apache.cxf.common.util.SpringClasspathScanner#findClassesInternal
       for (final String basePackage: basePackages) {
                  final boolean scanAllPackages = basePackage.equals(WILDCARD);
                  final String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
                      + (scanAllPackages ? "" : ClassUtils.convertClassNameToResourcePath(basePackage))
                      + ALL_CLASS_FILES;
      
      ClassUtils.convertClassNameToResourcePath(basePackage)

      only converts '.' to '/', and since

          public static final String ALL_FILES = "**/*";
          public static final String ALL_CLASS_FILES = ALL_FILES + ".class";
      

      so foo.bar.baz becomes classpath*:foo/bar/baz**/*.class instead of classpath*:foo/bar/baz/**/*.class

      Attachments

        Activity

          People

            ffang Freeman Yue Fang
            lgoldstein Lyor Goldstein
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: