prime
prime

Reputation: 15584

Error when building the project after add a <jarModule> to maven pom.xml :Artifact is not a dependency of the project

I have added a new <jarModule> to my maven pom.xml file.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-ear-plugin</artifactId>
    ............
    <jarModule>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <excluded>true</excluded>
    </jarModule>
    ............
</plugin>

All the project building was happend correctly until I added this <jarmodule>.

An Error will shown like below:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-ear-plugin:2.6:generate-application-xml (default-generate-application-xml) on project ABCD : Artifact[jar:javax.transaction:jta] is not a dependency of the project.

What am I doing wrong here? Is there something I've missed? Thanks.

Upvotes: 2

Views: 1618

Answers (1)

VonC
VonC

Reputation: 1328712

I confirm you need to add a dependency in your project dependencies section:

<project>
  <dependencies>
    <dependency>
      <groupId>javax.transaction</groupId>
      <artifactId>jta</artifactId>
      <version>x.y</version>
      <type>jar</jar>
    </dependency>

Replace x.y by the right version.
Note the <type>jar</jar>. I had a similar error:

Failed to execute goal org.apache.maven.plugins:maven-ear-plugin:2.7:generate-application-xml  
(default-generate-application-xml) on project xxx:  
Artifact[ejb:a.group:anArtifact] is not a dependency of the project.

And that even though my dependency was there!
But I was missing <type>ejb</type> in said dependency.

Upvotes: 0

Related Questions