cancel
Showing results for 
Search instead for 
Did you mean: 

Amp/Amp Dependency

stephenl
Champ on-the-rise
Champ on-the-rise
Hi,

Just wondering if there's a way to add one of my repo AMPs as a dependency of another? I have added it as a dependency in the pom.xml:


<dependency>
  <groupId>mygroup</groupId>
    <artifactId>my_art</artifactId>
    <version>0.0.1</version>
    <scope>provided</scope>
    <type>amp</type>
</dependency>


The issue I actually need to solve is that I need access to the Java classes from the dependency AMP, more specifically I need to inject the bean into a webscript etc. The AMP seems to build fine but the classes are not available.

Thanks,
Stephen
2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator
Hello,

unfortunately AMP dependencies aren't supported by the SDK or standard Maven. As far as I know the recommendation is to extract the relevant code (i.e. interfaces) into a separate JAR project which you can the package into the first AMP and reference (but not include) from the second one.
Of course you could try to setup the first AMP project to also produce a JAR, so you don't have to separate the code out. Unfortunately, the SDK does not make this as easy as it should be - we use a non-SDK custom Maven setup for this.

Regards
Axel

stephenl
Champ on-the-rise
Champ on-the-rise
Thanks for the information and suggestions Axel, it's a shame really as all I wanted to do was call some functionality contained within another AMP (that I have control over) without having to duplicate code.

Might be better to use a shared JAR file and make the AMPs themselves be more lightweight.

Thanks,
Stephen