Composite components in an external JAR are not recognized in Netbeans

后端 未结 1 961
攒了一身酷
攒了一身酷 2021-01-13 17:29

I have packaged a number of composite components in a JAR. However, when using them in another project (using Maven), Netbeans editor puts red error lines under lines which

相关标签:
1条回答
  • 2021-01-13 17:51

    I have absolutely the same problem. In my case it depends on the /src/main/java folder. If it's exist (only in the project and not even in the jar) the project which includes this library shows the "No library found for namespace... " When i remove the "java" folder it works. But then my backing bean class is missed in the jar...

    Tried with Netbeans 7.2 and 7.3, maven 2

    Solution:

    1. Generate a second project which contains the Java source files. (called: jsf-lib-java)
    2. In jsf-lib project (your composite component project with xhtml) delete the "java" folder and all *.java sources.
    3. add in the jsf-lib pom.xml following configuration:


    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.mycompany.project</groupId>
                  <artifactId>jsf-lib-java</artifactId>
                  <version>1.0-SNAPSHOT</version>
                  <type>jar</type>
                  <overWrite>true</overWrite>
                  <outputDirectory>src/main/</outputDirectory>
                  <includes>**/*.class</includes>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
    

    That's it. This will generate a "good" jar file with the required *.class files. So it's possible to "trick" Netbeans.

    Now i work with this solution. It's a hack but didn't found a better solution.

    0 讨论(0)
提交回复
热议问题