In standalone mode, all maven access is performed using pax-url-aether library. In fabric mode, the same happens via fabric-maven.
There's much new information about Maven in official Fuse docs, but also you can check:
- http://ggrzybek.blogspot.com/2016/07/using-maven-with-osgi-part-1.html (Aether information)
- http://ggrzybek.blogspot.com/2016/07/using-maven-with-osgi-part-2.html (Configuration of pax-url-aether)
- http://ggrzybek.blogspot.com/2016/10/using-maven-with-osgi-part-3.html (SNAPSHOT handling)
To give you a quick summary, if you want to add your external Artifactory server (actually it's recommended approach if you have several fabric containers), please add its URL to io.fabric8.agent PID, org.ops4j.pax.url.mvn.repositories property. You can add it via hawtio or using OSGi command:
profile-edit --pid io.fabric8.agent/org.ops4j.pax.url.mvn.repositories=http://my.artifactory.com:PORT/xyz default
you can also use --append option for the above command, but actually it's better to use hawtio - you can adjust the default settings to your needs.
but I'm still getting an error.
I've added my artifactory repos
But it still just searches the local repos. Doesn't bother with mine.
The log:display says:
java.io.IOException: Error resolving artifact my.company:authorizationService:jar:4.0.2: Could not find artifact my.company:authorizationService:jar:4.0.2 in karaf-default (file:/opt/fuse/system/)
and hawtio has a similar, but URL style error:
Caused by: java.io.IOException: Error resolving artifact my.company:authorizationService:jar:4.0.2: Could not find artifact my.company:authorizationService:jar:4.0.2 in repo_1511216736 (http://10.20.30.46:8181/maven/download/)
It's just ignoring my remote repo settings?
io.fabric8.agent PID and org.ops4j.pax.url.mvn.repositories property is used by fabric-agent to provision the container.
The list of remote repositories from this property is prepended with a list of fabric-mavaen-proxy repositories that registered itself in ZooKeeper registry. So agent actually first asks fabric-maven-proxy (you can see its url in the error message: "Could not find artifact my.company:authorizationService:jar:4.0.2 in repo_1511216736 (http://10.20.30.46:8181/maven/download/)").
That means that the fabric-maven-proxy can't find the artifact. You can always try invoking:
curl -v http://10.20.30.46:8181/maven/download/my/company/authorizationService/4.0.2/authorizationService-4.0.2.jarfabric-maven-proxy uses relevant configuration from io.fabric8.maven PID and io.fabric8.maven.repositories property, which by default points to io.fabric8.agent PID and org.ops4j.pax.url.mvn.repositories property - but please check it.I suggest increasing Maven-related logging as well:
profile-edit --pid org.ops4j.pax.logging/log4j.logger.org.eclipse.aether=TRACE karaf profile-edit --pid org.ops4j.pax.logging/log4j.logger.org.apache.http.headers=DEBUG karaf profile-edit --pid org.ops4j.pax.logging/log4j.logger.io.fabric8.maven.util=TRACE karaf profile-edit --pid org.ops4j.pax.logging/log4j.logger.io.fabric8.maven.url=TRACE karaf profile-edit --pid org.ops4j.pax.logging/log4j.logger.io.fabric8.agent.download=DEBUG karaf
this way you'll see in logs which repositories are actually being contacted.