java - Maven install-file not effective in GitLab/Docker: "could not resolve dependencies for project" -
i'm trying build java project on gitlab server using maven in docker. because use 3rd party jars, install them locally using install-file plugin. is/seems succesfull both on local machine, on docker:
$ mvn install:install-file -dfile=lib/customartifact-1.0.jar -dgroupid=customartifact -dartifactid=customartifact -dversion=1.0 -dpackaging=jar [info] scanning projects... [info] [info] ------------------------------------------------------------------------ [info] building myproject 1.0-snapshot [info] ------------------------------------------------------------------------ [info] [info] --- maven-install-plugin:2.4:install-file (default-cli) @ myproject --- [info] installing /builds/gitlab/myproject-groep/myproject/lib/customartifact-1.0.jar /root/.m2/repository/customartifact/customartifact/1.0/customartifact-1.0.jar [info] installing /tmp/mvninstall2011198835315637645.pom /root/.m2/repository/customartifact/customartifact/1.0/customartifact-1.0.pom [info] ------------------------------------------------------------------------ [info] build success [info] ------------------------------------------------------------------------ [info] total time: 1.191 s [info] finished at: 2016-11-10t07:35:47+00:00 [info] final memory: 8m/144m [info] ------------------------------------------------------------------------
but on docker error, absent on local machine:
$ mvn --batch-mode --quiet clean install -dskiptests [error] failed execute goal on project myproject: not resolve dependencies project groupid:myproject:jar:1.0-snapshot: failed collect dependencies @ customartifact:customartifact:jar:1.0: failed read artifact descriptor customartifact:customartifact:jar:1.0: not transfer artifact customartifact:customartifact:pom:1.0 from/to myproject_dependencies (/builds/gitlab/myproject-groep/ myproject/lib): cannot access /builds/gitlab/myproject-groep/ myproject/lib type default using available connector factories: basicrepositoryconnectorfactory: cannot access /builds/gitlab/myproject-groep/myproject/lib using registered transporter factories: wagontransporterfactory: unsupported transport protocol -> [help 1]
i don't wrong here. missing in path, environmental variable? should minor, i'm literally doing same locally.
help appreciated!
edit:
i'm using docker maven:3-jdk-7,
openjdk:7-jdk arg maven_version=3.3.9 arg user_home_dir="/root" run mkdir -p /usr/share/maven /usr/share/maven/ref \ && curl -fssl http://apache.osuosl.org/maven/maven-3/$maven_version/binaries/apache-maven-$maven_version-bin.tar.gz \ | tar -xzc /usr/share/maven --strip-components=1 \ && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn env maven_home /usr/share/maven env maven_config "$user_home_dir/.m2" copy mvn-entrypoint.sh /usr/local/bin/mvn-entrypoint.sh copy settings-docker.xml /usr/share/maven/ref/ volume "$user_home_dir/.m2" entrypoint ["/usr/local/bin/mvn-entrypoint.sh"] cmd ["mvn"]which found here
settings-docker.xml
<settings xmlns="http://maven.apache.org/settings/1.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/settings/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <localrepository>/usr/share/maven/ref/repository</localrepository> </settings>
localy
installing thrid-party libraries using mvn install:install-file
install them default in /.m2/repository. mvn clean install
pick them default repository i.e /.m2/repository.
in docker container
installing thrid-party libraries using mvn install:install-file
install them in /usr/share/maven/ref/repository
(inside container) defined in settings-docker.xml. mvn clean install
pick them /usr/share/maven/ref/repository
.
the issue maven looking dependencies in /builds/gitlab/myproject-groep/myproject/lib
defined in pom file, directory not exposed docker container.
<repositories> <repository> <id>myproject_dependencies</id> <url>${basedir}/lib/</url> </repository> </repositories>
removing repositories section pom file should resolve issue.
Comments
Post a Comment