仅在作者上安装内容包?

时间:2015-08-06 08:37:44

标签: configuration cq5 aem

我们有特殊的内容包,只能出现在作者身上。是否可以配置bundle来做到这一点?在maven pom中,唯一的区别是slingPort,我觉得依赖这个参数并不是很好。

我的pom dm-all的一部分,负责安装:

<dependencies>
           <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>dm-config</artifactId>
            <version>${project.version}</version>
            <type>content-package</type>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>dm-view</artifactId>
            <version>${project.version}</version>
            <type>content-package</type>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>dm-view-author</artifactId>
            <version>${project.version}</version>
            <type>content-package</type>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>dm-content</artifactId>
            <version>${project.version}</version>
            <type>content-package</type>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>dm-services</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-osgi-registry</artifactId>
        </dependency>
        <dependency>
            <groupId>com.cqblueprints.taglib</groupId>
            <artifactId>cqblueprints-taglib-all</artifactId>
            <version>5.5.1</version>
            <type>zip</type>
        </dependency>
        <!-- extensions -->
        <dependency>
            <groupId>org.apache.wink</groupId>
            <artifactId>wink-osgi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.aopalliance</groupId>
            <artifactId>com.springsource.org.aopalliance</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>com.springsource.javax.inject</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>com.day.jcr.vault</groupId>
                <artifactId>content-package-maven-plugin</artifactId>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <goals>
                            <goal>package</goal>
                        </goals>
                        <configuration>
                            <filters>
                                <filter>
                                    <root>/apps/dm/install</root>
                                </filter>
                            </filters>

                            <embeddedTarget>/apps/dm/install</embeddedTarget>
                            <embeddeds>
                                <embedded>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>dm-services</artifactId>
                                    <filter>true</filter>
                                </embedded>
                                <!-- extensions -->
                                <embedded>
                                    <groupId>org.apache.wink</groupId>
                                    <artifactId>wink-osgi</artifactId>
                                    <filter>true</filter>
                                </embedded>
                                <embedded>
                                    <groupId>com.google.guava</groupId>
                                    <artifactId>guava</artifactId>
                                    <filter>true</filter>
                                </embedded>
                                <embedded>
                                    <groupId>org.aopalliance</groupId>
                                    <artifactId>com.springsource.org.aopalliance</artifactId>
                                </embedded>
                                <embedded>
                                    <groupId>javax.inject</groupId>
                                    <artifactId>com.springsource.javax.inject</artifactId>
                                </embedded>
                                <embedded>
                                    <groupId>org.apache.geronimo.specs</groupId>
                                    <artifactId>geronimo-osgi-registry</artifactId>
                                </embedded>
                                <embedded>
                                    <groupId>org.osgi</groupId>
                                    <artifactId>org.osgi.core</artifactId>
                                </embedded>
                            </embeddeds>
                            <subPackages>
                                <subPackage>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>dm-config</artifactId>
                                    <filter>true</filter>
                                </subPackage>
                                <subPackage>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>dm-view</artifactId>
                                    <filter>true</filter>
                                </subPackage>
                                <subPackage>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>dm-content</artifactId>
                                    <filter>true</filter>
                                </subPackage>
                                <subPackage>
                                    <groupId>com.cqblueprints.taglib</groupId>
                                    <artifactId>cqblueprints-taglib-all</artifactId>
                                    <filter>true</filter>
                                </subPackage>
                                <subPackage>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>dm-view-author</artifactId>
                                    <filter>true</filter>
                                </subPackage>
                            </subPackages>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>deploy-all</id>
            <!--
                when activated, this profile will deploy and install the built CQ package to the target server.
            -->
            <activation>
                <property>
                    <name>deployPackage</name>
                    <value>true</value>
                </property>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>com.day.jcr.vault</groupId>
                        <artifactId>content-package-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>install-package</id>
                                <goals>
                                    <goal>install</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

dm-view-author的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/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>CQ</artifactId>
        <groupId>EF</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>dm-view-author</artifactId>
    <packaging>content-package</packaging>

    <name>${project.groupId} - ${project.artifactId}</name>

    <description>
        Content package that deployed only on author instance.
    </description>

    <build>
        <plugins>
            <plugin>
                <groupId>com.day.jcr.vault</groupId>
                <artifactId>content-package-maven-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-content-resources</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/vault-work</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/src/main/content</directory>
                                    <filtering>true</filtering>
                                    <excludes>
                                        <exclude>**/.svn</exclude>
                                        <exclude>**/.vlt</exclude>
                                        <exclude>**/.vltignore</exclude>
                                        <exclude>**/.DS_Store</exclude>
                                    </excludes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

1 个答案:

答案 0 :(得分:1)

我建议将“仅限作者”资源(java / jsp / xmls)移动到单独的内容包中,并将配置文件仅部署到作者(使用作者的目标网址)?这将使作者专用资源和通用资源保持独立和模块化。