Java 在CQ5 Archtype中使用JspC时在Maven项目中找不到global.jsp?

Java 在CQ5 Archtype中使用JspC时在Maven项目中找不到global.jsp?,java,eclipse,jsp,maven,aem,Java,Eclipse,Jsp,Maven,Aem,我创建了多模块CQ5 Maven项目。我的Cq版本是5.5,Java版本是6 这些是我遵循的步骤 创建maven多模块CQ maven项目 在eclipse中导入了它 使用VLT将现有项目从存储库导入maven 将项目转换为切面形式,以便捆绑部件可以正常工作 在内容模块中,我尝试使用JspC插件,我在相应的POM文件中添加了正确的插件信息和依赖项 问题是编译JspC时说找不到global.jsp 所以我在我的项目中也导入了/libs,并确保libs不包含在build中。通过排除/libs文件夹。

我创建了多模块CQ5 Maven项目。我的Cq版本是5.5,Java版本是6

这些是我遵循的步骤

  • 创建maven多模块CQ maven项目
  • 在eclipse中导入了它
  • 使用VLT将现有项目从存储库导入maven
  • 将项目转换为切面形式,以便捆绑部件可以正常工作
  • 内容模块中,我尝试使用JspC插件,我在相应的POM文件中添加了正确的插件信息和依赖项
  • 问题是编译JspC时说找不到global.jsp

    所以我在我的项目中也导入了/libs,并确保libs不包含在build中。通过排除/libs文件夹。我引用了这个链接

    我的JSP中有默认的自动完成功能,但它们无法识别任何CQ对象,如
    为什么??

    我引用了这个链接

    我的目录结构

    我的内容POM如下

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <!-- ====================================================================== -->
        <!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
        <!-- ====================================================================== -->
        <parent>
            <groupId>supplierportal</groupId>
            <artifactId>supplierportal</artifactId>
            <version>1.1-SNAPSHOT</version>
        </parent>
    
        <!-- ====================================================================== -->
        <!-- P R O J E C T D E S C R I P T I O N -->
        <!-- ====================================================================== -->
    
        <artifactId>supplierportal-content</artifactId>
        <packaging>content-package</packaging>
        <name>Supplier Portal Package</name>
    
        <dependencies>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>supplierportal-bundle</artifactId>
                <version>${project.version}</version>
            </dependency>
    
            <!-- My Dependencies -->
            <!-- Dependencies for Maven JSPC Starts -->
            <dependency>
                <groupId>org.apache.sling</groupId>
                <artifactId>org.apache.sling.jcr.jcr-wrapper</artifactId>
                <version>2.0.0</version>
                <!-- javax.jcr -->
            </dependency>
            <dependency>
                <groupId>org.apache.sling</groupId>
                <artifactId>org.apache.sling.api</artifactId>
                <version>2.2.0</version>
            </dependency>
            <dependency>
                <groupId>com.day.cq</groupId>
                <artifactId>cq-commons</artifactId>
                <version>5.5.0</version>
                <!-- com.day.cq.commons -->
            </dependency>
            <dependency>
                <groupId>com.day.cq.wcm</groupId>
                <artifactId>cq-wcm-commons</artifactId>
                <version>5.5.2</version>
                <!-- com.day.cq.wcm.commons -->
            </dependency>
            <dependency>
                <groupId>com.day.cq.wcm</groupId>
                <artifactId>cq-wcm-api</artifactId>
                <version>5.5.0</version>
                <!-- com.day.cq.wcm.api -->
            </dependency>
            <dependency>
                <groupId>com.day.commons</groupId>
                <artifactId>day-commons-jstl</artifactId>
                <version>1.1.4</version>
                <!-- javax.servlet.jsp.jstl.core -->
            </dependency>
            <dependency>
                <groupId>com.day.cq.wcm</groupId>
                <artifactId>cq-wcm-taglib</artifactId>
                <version>5.5.0</version>
                <!-- com.day.cq.wcm.tags -->
            </dependency>
            <dependency>
                <groupId>org.apache.sling</groupId>
                <artifactId>org.apache.sling.scripting.jsp.taglib</artifactId>
                <version>2.2.0</version>
                <!-- org.apache.sling.scripting.jsp.taglib -->
            </dependency>
            <dependency>
                <groupId>com.adobe.granite</groupId>
                <artifactId>com.adobe.granite.xssprotection</artifactId>
                <version>5.5.14</version>
                <!-- com.adobe.granite.xss -->
            </dependency>
            <dependency>
                <groupId>com.day.cq.wcm</groupId>
                <artifactId>cq-wcm-core</artifactId>
                <version>5.5.6</version>
                <!-- com.day.cq.wcm.core.components -->
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.0</version>
                <!-- org.apache.commons.lang3 -->
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.5.10</version>
            </dependency>
            <!-- Ends -->
    
        </dependencies>
        <build>
            <resources>
                <resource>
                    <directory>src/main/content/jcr_root</directory>
                    <filtering>false</filtering>
                    <excludes>
                        <exclude>**/.vlt</exclude>
                        <exclude>**/.vltignore</exclude>
                        <exclude>libs/</exclude>
                    </excludes>
                </resource>
    
    
    
            </resources>
    
        <!-- Autocomplete Plugin config comes here -->
            <!-- THis is Completely different Stuff... An Attempt to bring autocomplete feature in JSP -->
            <pluginManagement>
        <plugins>
          <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
          <plugin>
            <groupId>org.eclipse.m2e</groupId>
            <artifactId>lifecycle-mapping</artifactId>
            <version>1.0.0</version>
            <configuration>
              <lifecycleMappingMetadata>
                <pluginExecutions>
                  <pluginExecution>
                    <pluginExecutionFilter>
                      <groupId>org.apache.sling</groupId>
                      <artifactId>maven-jspc-plugin</artifactId>
                      <versionRange>[2.0.6,)</versionRange>
                      <goals>
                        <goal>jspc</goal>
                      </goals>
                    </pluginExecutionFilter>
                    <action>
                      <ignore/>
                    </action>
                  </pluginExecution>
                  <pluginExecution>
                    <pluginExecutionFilter>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-clean-plugin</artifactId>
                      <versionRange>[2.4.1,)</versionRange>
                      <goals>
                        <goal>clean</goal>
                      </goals>
                    </pluginExecutionFilter>
                    <action>
                      <ignore/>
                    </action>
                  </pluginExecution>
                </pluginExecutions>
              </lifecycleMappingMetadata>
            </configuration>
          </plugin>
        </plugins>
      </pluginManagement>
            <!-- Autocomplete Ends -->
    
    
        <!-- Ends Autocomplete -->
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <configuration>
                        <includeEmptyDirs>true</includeEmptyDirs>
                    </configuration>
                </plugin>
    
                <plugin>
                    <groupId>com.day.jcr.vault</groupId>
                    <artifactId>content-package-maven-plugin</artifactId>
                    <extensions>true</extensions>
                    <configuration>
                        <group>supplierportal</group>
                        <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
                        <embeddeds>
                            <embedded>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>supplierportal-bundle</artifactId>
                                <target>/apps/supplierportal/install</target>
                            </embedded>
                        </embeddeds>
                        <targetURL>http://${crx.host}:${crx.port}/crx/packmgr/service.jsp</targetURL>
                    </configuration>
                </plugin>
    
                <!-- Here I add code for JSPc Plugin -->
    
                <!-- start -->
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>copy-resources</id>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${project.build.directory}/jsps-to-compile</outputDirectory>
                                <resources>
                                    <resource>
                                        <directory>src/main/content/jcr_root</directory>
                                        <excludes>
                                            <exclude>libs/**</exclude>
                                        </excludes>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>maven-jspc-plugin</artifactId>
                    <version>2.0.6</version>
                    <executions>
                        <execution>
                            <id>compile-jsp</id>
                            <goals>
                                <goal>jspc</goal>
                            </goals>
                            <configuration>
                                <jasperClassDebugInfo>false</jasperClassDebugInfo>
                                <sourceDirectory>${project.build.directory}/jsps-to-compile</sourceDirectory>
                                <outputDirectory>${project.build.directory}/ignoredjspc</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>remove-compiled-jsps</id>
                            <goals>
                                <goal>clean</goal>
                            </goals>
                            <phase>process-classes</phase>
                            <configuration>
                                <excludeDefaultDirectories>true</excludeDefaultDirectories>
                                <filesets>
                                    <fileset>
                                        <directory>${project.build.directory}/jsps-to-compile</directory>
                                        <directory>${project.build.directory}/ignoredjspc</directory>
                                    </fileset>
                                </filesets>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <!-- end -->
    
                <!-- Ends JSPC plugin config -->
    
            </plugins>
    
        </build>
        <profiles>
            <profile>
                <id>autoInstallPackage</id>
                <build>
                    <plugins>
                        <plugin>
                            <groupId>com.day.jcr.vault</groupId>
                            <artifactId>content-package-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>install-content-package</id>
                                    <phase>install</phase>
                                    <goals>
                                        <goal>install</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </build>
            </profile>
            <profile>
                <id>autoInstallPackagePublish</id>
                <build>
                    <plugins>
                        <plugin>
                            <groupId>com.day.jcr.vault</groupId>
                            <artifactId>content-package-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>install-content-package-publish</id>
                                    <phase>install</phase>
                                    <goals>
                                        <goal>install</goal>
                                    </goals>
                                    <configuration>
                                        <targetURL>http://${publish.crx.host}:${publish.crx.port}/crx/packmgr/service.jsp</targetURL>
                                        <username>${publish.crx.username}</username>
                                        <password>${publish.crx.password}</password>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </build>
            </profile>
        </profiles>
    
    </project>
    
    
    4.0.0
    供应商门户
    供应商门户
    1.1-快照
    供应商门户内容
    内容包
    供应商门户包
    ${project.groupId}
    供应商门户包
    ${project.version}
    org.apache.sling
    org.apache.sling.jcr.jcr-wrapper
    2.0.0
    org.apache.sling
    org.apache.sling.api
    2.2.0
    com.day.cq
    cq公共空间
    5.5.0
    com.day.cq.wcm
    cq-wcm-commons
    5.5.2
    com.day.cq.wcm
    cq-wcm-api
    5.5.0
    com.day.commons
    公共日jstl
    1.1.4
    com.day.cq.wcm
    cq-wcm-taglib
    5.5.0
    org.apache.sling
    org.apache.sling.scripting.jsp.taglib
    2.2.0
    com.adobe.granite
    com.adobe.granite.xsp保护
    5.5.14
    com.day.cq.wcm
    cq-wcm核
    5.5.6
    org.apache.commons
    commons-lang3
    3
    org.slf4j
    slf4j api
    1.5.10
    src/main/content/jcr_root
    假的
    **/.vlt
    **/伏尔蒂诺尔先生
    自由基/
    org.eclipse.m2e
    生命周期映射
    1.0.0
    org.apache.sling
    maven jspc插件
    [2.0.6,)
    jspc
    org.apache.maven.plugins
    maven清洁插件
    [2.4.1,)
    清洁的
    org.apache.maven.plugins
    maven资源插件
    真的
    com.day.jcr.vault
    内容包maven插件
    真的
    供应商门户
    src/main/content/META-INF/vault/filter.xml
    ${project.groupId}
    供应商门户包
    /应用程序/供应商门户/安装
    http://${crx.host}:${crx.port}/crx/packmgr/service.jsp
    maven资源插件
    复制资源
    生成源
    复制资源
    要编译的${project.build.directory}/JSP
    src/main/content/jcr_root
    自由基/**
    org.apache.sling
    maven jspc插件
    2.0.6
    编译jsp
    jspc
    假的
    要编译的${project.build.directory}/JSP
    ${project.build.directory}/ignoredjspc
    maven清洁插件
    删除已编译的JSP
    
    <resource>  
          <directory>src/main/content/jcr_root</directory>  
          <includes>  
              <include>apps/**</include>  
              <include>libs/foundation/global.jsp</include>
        </includes>  
      </resource>  
    
    <build>
            <resources>
                <resource>
                    <directory>src/main/content/jcr_root</directory>
                    <filtering>false</filtering>
                    <excludes>
                        <exclude>**/.vlt</exclude>
                        <exclude>**/.vltignore</exclude>
                        <exclude>libs/</exclude>
                    </excludes>
                </resource>
    
    
    
            </resources>
    
    {yourproject}\content\src\main\content\META-INF\vault\filter-vlt.xml
    
    <?xml version="1.0" encoding="UTF-8"?>
    <workspaceFilter version="1.0">
        <filter root="/libs/foundation"/>
        <filter root="/apps/myapp"/>
        <filter root="/etc/designs/myapp"/>
         <filter root="/etc/designs/bootstrap-custom-version2"/>
    </workspaceFilter>
    
    <?xml version="1.0" encoding="UTF-8"?>
    <workspaceFilter version="1.0">
        <filter root="/apps/myapp"/>
         <filter root="/etc/designs/myapp"/>
         <filter root="/etc/designs/bootstrap-custom-version2"/>     
    </workspaceFilter>
    
    vlt up --force