On 26/08/2015 14:56, Mustafa Ergin wrote:
Hello,

This is the original pom file,
Hi Mustafa.

I have some large multimodules project using deltaspike and maven. The way I proceed has evolved with time... Here is what I am doing today.

I tend to have an artefact (a maven project, with a pom.xml file) grouping the common, "standard", dependencies of my multi-module project. For the two big projects I handle nowadays, this artefact is named jsf-stack. In its pom.xml I define both dependencies and "dependencies versions" using the dependency management mechanism.

This artefact is a "BOM" (Bill of Materials), a special kind of dependency that is used to import the dependency management section (see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies ).

This way, you can define the version of all the deltaspike modules used by all your webapps in the dependency management section of your artefact grouping common dependencies, even if not all your webapps use them. And you can define those of them who are used by all modules as classic dependencies.

As of today, I have in jsf-stack the following dependencies and dependencyManagement sections for DS :

    <dependencies>
        <dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-impl</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-bean-validation-module-impl</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jpa-module-impl</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jsf-module-api</artifactId>
        </dependency>

        <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jsf-module-impl</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-scheduler-module-api</artifactId>
        </dependency>

        <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-scheduler-module-impl</artifactId>
            <scope>provided</scope>
        </dependency>

<!-- quartz, implémentation préconisée en conjonction avec deltaspike-scheduler-module -->
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
        </dependency>

        <dependency>
<groupId>org.apache.deltaspike.cdictrl</groupId>
<artifactId>deltaspike-cdictrl-api</artifactId>
        </dependency>

        <dependency>
<groupId>org.apache.deltaspike.cdictrl</groupId>
<artifactId>deltaspike-cdictrl-owb</artifactId>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-api</artifactId>
                <version>1.5.0</version>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-impl</artifactId>
                <version>1.5.0</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-bean-validation-module-api</artifactId>
                <version>1.5.0</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-bean-validation-module-impl</artifactId>
                <version>1.5.0</version>
                <scope>runtime</scope>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jpa-module-api</artifactId>
                <version>1.5.0</version>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jpa-module-impl</artifactId>
                <version>1.5.0</version>
                <scope>runtime</scope>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jsf-module-api</artifactId>
                <version>1.5.0</version>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jsf-module-impl</artifactId>
                <version>1.5.0</version>
                <scope>runtime</scope>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-security-module-api</artifactId>
                <version>1.5.0</version>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-security-module-impl</artifactId>
                <version>1.5.0</version>
                <scope>runtime</scope>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-scheduler-module-api</artifactId>
                <version>1.5.0</version>
                <scope>compile</scope>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-scheduler-module-impl</artifactId>
                <version>1.5.0</version>
                <scope>runtime</scope>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-servlet-module-api</artifactId>
                <version>1.5.0</version>
                <scope>compile</scope>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-servlet-module-impl</artifactId>
                <version>1.5.0</version>
                <scope>runtime</scope>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-test-control-module-api</artifactId>
                <version>1.5.0</version>
            </dependency>
            <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-test-control-module-impl</artifactId>
                <version>1.5.0</version>
            </dependency>
<!-- quartz, implémentation préconisée en conjonction avec deltaspike-scheduler-module -->
            <dependency>
                <groupId>org.quartz-scheduler</groupId>
                <artifactId>quartz</artifactId>
                <version>2.2.1</version>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.cdictrl</groupId>
<artifactId>deltaspike-cdictrl-api</artifactId>
                <version>1.5.0</version>
                <scope>compile</scope>
            </dependency>

            <dependency>
<groupId>org.apache.deltaspike.cdictrl</groupId>
<artifactId>deltaspike-cdictrl-owb</artifactId>
                <version>1.5.0</version>
                <scope>runtime</scope>
            </dependency>
    </dependencies>

    </dependencyManagement>

I also play with the scope of dependencies to have some included in the war of the webapps and some not. Dependency scopes are explained there : https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope

As I am using a dedicated tomcat instance for the webapps of the two applications I mentionned before, I tend to install most, if not all, common jars in tomcat/lib. This keeps the webapps smallers (which is not really important to me) and (much more important) is required for some modules to work. I am not sure it was for some DS modules, but it is for openwebbeans-tomcat7, for instance.

So, in the pom of webapps A and B, I will have a dependency on jsf-stack :

<dependencies>
            <dependency>
                <groupId>fr.senat.presences</groupId>
                <artifactId>jsf-stack</artifactId>
                <version>1.0.17</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

        [...]
</dependencies>

Note the use of the "special" scope import, for BOM.

If in webapp A I want in addition to use deltaspike security module, I will just add

        <dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-security-module-api</artifactId>
        </dependency>

No version is specified, as it is "dependency managed".

Proceeding this way makes it easy to switch to a new DS version. I just update the base jsf-stack artefact.

Hope this helps.

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|

Reply via email to