I'm facing the followinf issue :
Failed to execute goal org.apache.maven.plugins:maven-ear-plugin:2.7:generate-application-xml (default-generate-application-xml) on project UserAdminEAR: Artifact[war:com.syril.administration:UserAdmin] is not a dependency of the project. -> [Help 1]
what is the solution for this kind of error?
my pom.xml is
<modelVersion>4.0.0</modelVersion>
<groupId>UserAdminEAR</groupId>
<artifactId>UserAdminEAR</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>UserAdmin</name>
<packaging>ear</packaging>
<dependencies>
    <dependency>
        <groupId>com.syril.dao</groupId>
        <artifactId>dataAccess</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>com.syril.service</groupId>
        <artifactId>UserAdminService</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>war</type>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <defaultLibBundleDir>lib</defaultLibBundleDir>
                <modules>
                    <jarModule></jarModule>
                    <javaModule>
                        <groupId>com.syril.dao</groupId>
                        <artifactId>dataAccess</artifactId>
                        <includeInApplicationXml>true</includeInApplicationXml>
                    </javaModule>
                    <webModule>
                        <groupId>com.syril.service</groupId>
                        <artifactId>UserAdminSL</artifactId>
                        <contextRoot>/UserAdminSL</contextRoot>
                    </webModule>
                </modules>
            </configuration>
        </plugin>
    </plugins>
</build>
This plugin generates Java EE Enterprise Archive (EAR) file. It can also generate the deployment descriptor file (e.g. application. xml ).
Enterprise application archive – or ear – is a compressed file that contains a J2EE application. It consists of one or more modules that can be either web modules (packaged as a war file) or EJB modules (packaged as a jar file) or both of them.
if you have EAR file you can unpack it: maven.apache.org/plugins/maven-ear-plugin/examples/… and then add war, change application. xml and pack it again.
You will have to add the war as a dependency to the project too, not only in the plugin configuration.
<project ...>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.syril.administration</groupId>
    <artifactId>UserAdminEAR</artifactId> 
    <version>YOUR_VERSION_HERE</version>
    <packaging>ear</packaging>
    <dependencies>
        <!-- some other dependencies here -->
        ...
        <!-- Here is the dependency to the war that is referenced in the ear plugin -->
        <dependency> 
            <groupId>com.syril.administration</groupId> 
            <artifactId>UserAdmin</artifactId> 
            <version>YOUR_VERSION_HERE</version> 
            <type>war</type> 
        </dependency>
    </dependencies>
    ...
</project>
Edit
The <webModule/> artifact is not in your <dependencies/> list. That is what I was suggesting.
Add the following:
<dependency>
    <groupId>com.syril.service</groupId>
    <artifactId>UserAdminSL</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <type>war</type>
</dependency>
OR
Change the <webModule/>:
<webModule>
    <groupId>com.syril.service</groupId>
    <artifactId>UserAdminService</artifactId>
    <contextRoot>/UserAdminSL</contextRoot>
</webModule>
That is of course if UserAdminService is the same as UserAdminSL which I think.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With