Docker maven set up -- reading jar files from a remote repo during runtime,

1,629 views
Skip to first unread message

Saroj

unread,
Aug 21, 2016, 10:10:02 PM8/21/16
to Drools Setup
Hi,

We have a set up as follows:

1. We have a webservice which processes the rules through KIE sessions.
2. KIE spring integration is done so that the sessions are created during server start up.
3. During server start up the application refers a remote repo during runtime from a remote repo not from local m2.[We have achieved this by having the custom settings.xml in the .m2 folder ]

Everything is working fine in my local windows i.e. the jars are downloaded runtime during server start up.

Now the requirement is to run the above set up in a docker.

I have tried to create a docker image with the following written in dockerfile, 

FROM maven:3.3-jdk-8
EXPOSE 8080
ADD settings.xml /root/.m2/settings.xml

But when I start the container the application code tries to get the jar file from default maven repo i.e. 

Unable to resolve artifact: demo:KieSessionFinal:pom:1.0 org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact demo:KieSessionFinal:pom:1.0 in central (http://repo1.maven.org/maven2/)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(Defa
ultArtifactResolver.java:444) ~[aether-impl-1.0.0.v20140518.jar:na]


Can anyone please help how do we set up the setting.xml in an dockerized environment so that it can read from the remote repo ?
where and how to place the settings.xml in the docker image or docker container ?

Regards
Saroj

Michael B

unread,
Aug 22, 2016, 4:55:38 AM8/22/16
to Drools Setup
Hi,


Could you please provide us the whole Dockerfile?
We want to check how you create the docker image?

Have you looked at kie-server-showcase or https://github.com/jboss-dockerfiles/drools/blob/master/kie-server/showcase/Dockerfile ,
this is the dockerfile we use for our docker images.

Regards

Michael

Saroj

unread,
Aug 22, 2016, 6:36:54 PM8/22/16
to Drools Setup
Here is my dockerfile content.

FROM java:7
RUN apt-get update
RUN apt-get install -y maven
RUN mkdir /usr/local/.m2
ADD settings.xml /usr/local/.m2/settings.xml
FROM tomcat:7-jre7
ADD eds-drools.war /usr/local/tomcat/webapps
ADD slf4j-api-1.7.20.jar /usr/local/tomcat/lib
ADD slf4j-jdk14-1.7.20.jar /usr/local/tomcat/lib
ADD kie-tomcat-integration-6.2.0.Final.jar /usr/local/tomcat/lib
ADD javax.security.jacc-api-1.5.jar /usr/local/tomcat/lib
ADD server.xml /usr/local/tomcat/conf
ADD tomcat-users.xml /usr/local/tomcat/conf
ADD setenv.sh /usr/local/tomcat/bin
CMD ["catalina.sh","run"]
EXPOSE 8090

Regards
Saroj

Michael B

unread,
Aug 23, 2016, 3:53:46 AM8/23/16
to Drools Setup
Hi,

Have you looked at your .m2 if the right settings.xml is there?
Are you sure you only have one .m2?

There are two locations where a settings.xml file may live:

  • The Maven install: ${maven.home}/conf/settings.xml
  • A user’s install: ${user.home}/.m2/settings.xml
1) Could you please check if the right settings.xml is copied to the right location
2) Could you please check if the configuration of settings.xml points to the right repositories
3) Could you please check if the settings.xml has the right permissions, since docker copies it?

Michael
 

Saroj

unread,
Aug 25, 2016, 3:04:53 PM8/25/16
to Drools Setup
Hi Michael,

I figured out the mistake in my dockerfile. 
It was not copying settings.xml because we have written the command like:

ADD settings.xml /root/.m2/settings.xml

Instead I wrote

ADD settings.xml /root/.m2/

and it worked.

Thanks for all your help and time.

Regards
Saroj

Michael B

unread,
Aug 26, 2016, 3:13:27 AM8/26/16
to Drools Setup
Welcome Saroj!
Reply all
Reply to author
Forward
0 new messages