How can i run project B successfully without explicitly putting a maven entry for the javax.mail jar?
Well, that's weird. c.s.m.s.SMTPTransport
is supposed to be provided by mail-1.4.1.jar
which is a dependency of commons-email
. Project B should get it transitively.
Could you run the following on project B and post the output
mvn dependency:tree
Update: There is definitely something weird with your dependencies and I can't reproduce the problem.
I quickly created a first project with the following pom:
<project>
...
<groupId>com.stackoverflow</groupId>
<artifactId>Q3875317-A</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</project>
And another one depending on the first artifact:
<project>
...
<groupId>com.stackoverflow</groupId>
<artifactId>Q3875317-B</artifactId>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>Q3875317-A</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
And here is the dependency tree I get for the second project:
$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Q3875317-B
[INFO] task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree {execution: default-cli}]
[INFO] com.stackoverflow:Q3875317-B:jar:1.0-SNAPSHOT
[INFO] +- com.stackoverflow:Q3875317-A:jar:1.0-SNAPSHOT:compile
[INFO] | \- org.apache.commons:commons-email:jar:1.2:compile
[INFO] | +- javax.mail:mail:jar:1.4.1:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] \- junit:junit:jar:3.8.1:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
...
Everything is there, as expected.
If you get a different result and if there is anything noticeable about your POMs, please show them.
PS: I removed one of the command I initially suggested as it didn't allow to see transitive dependencies.