1

I am trying to get an ESB system running using ServiceMix and ActiveMQ. But even before I get that far, I had a question about dependency types of POM. I got the maven dependency as:

<!-- https://mvnrepository.com/artifact/org.apache.servicemix/servicemix -->
<dependency>
    <groupId>org.apache.servicemix</groupId>
    <artifactId>servicemix</artifactId>
    <version>7.0.1</version>
    <type>pom</type>
</dependency>

Now when I run "clean install" on the the project in which I included this dependency, I don't see any of the activeMQ jars being copied in the classpath or available for compilation (I have copy-dependency written, so I can see what jar files are included). In this case, do I still have to explicitly mention the activeMQ dependency in my pom file? Like:

<!-- https://mvnrepository.com/artifact/org.apache.activemq/activemq-core -->
<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-core</artifactId>
</dependency>

Any guidance would be appreciated. This ServiceMix is frustrating with the lack of documentation.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
hell_storm2004
  • 1,401
  • 2
  • 33
  • 66
  • 1
    Does this answer your question? [What is the difference between "pom" type dependency with scope "import" and without "import"?](https://stackoverflow.com/questions/11778276/what-is-the-difference-between-pom-type-dependency-with-scope-import-and-wit) – Riaan Nel Dec 17 '19 at 10:09
  • I looked at that answer and a few other like it. I did include the dependency under `dependencyManagement` in my parent project and tried to use `import` scope in my child module, but i get the error `org.apache.servicemix:servicemix:pom must be one of [provided, compile, runtime, test, system] but is 'import'.` So that solution didn't help – hell_storm2004 Dec 17 '19 at 10:20

1 Answers1

2

If you put a dependency of type pom into your <dependencies>, Maven will use the content of the POM as transitive dependencies. So everything in that POM will become a part of the classpath unless it has something like test scope or its version is overridden by some other part of the POM.

Putting a POM into the <dependencyManagement> is a different thing. Note that scope import is only for <dependencyManagement>.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
  • So putting pom in a dependency under is similar to not putting it at all ? If yes then when putting it ? – Olivier Masseau May 17 '23 at 11:02
  • @OlivierMasseau Sorry, cannot follow you. As I said: If you have e.g. a pom with three dependencies, and you put that pom as dependency in your project, then the three dependencies will become transitive dependencies of your project. – J Fabian Meier May 17 '23 at 11:45
  • @J Fabien Meier I've detailed my question here : https://stackoverflow.com/questions/76271528/what-is-the-difference-between-using-and-not-using-typepom-type-for-a-depend (which I see you answered). Thanks ;) – Olivier Masseau May 17 '23 at 16:42