I'm trying to generate the jar for a maven project before building the image using a docker file:
FROM maven:3.2-jdk-7-onbuild
RUN mkdir /api
COPY . /api
RUN mvn package -f /api/pom.xml
EXPOSE 9000
Is this even possible? What i'm trying to do is to create a jar to execute it later.
I'm getting this among others:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.6:jar (default-jar) on project deivapi: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.6:jar failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-jar-plugin:2.6:jar: java.lang.ExceptionInInitializerError: null
[ERROR]
Related
I have 2 spring boot projects, one of them is the "core" which is used as a dependency by the second, called here "sascar".
I have a Dockerfile to generate the core image:
FROM maven:3.3-jdk-8
WORKDIR /opt/ivr-engine-core
ADD ./engine-core/. /opt/engine-core
RUN ls -la /opt/engine-core
RUN mvn clean install
Then I run to build the image:
docker build . -t engine-core
Then I start a docker container with the image just created using the main project (engine-sascar inside the app folder) and enter in the bash:
docker run -it --rm -w /app -v "$PWD/engine-sascar:/app" engine-core:latest bash
When inside the container I try to run the maven command to package or install, the point is, this main project canĀ“t reach the core project to use its classes:
mvn clean package
Resulting in:
[INFO] Compiling 35 source files to /app/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /app/src/main/java/com/app/sascar/StepOne.java:[8,33] package com.engine.core does not exist
How could I make this maven project inside this container "see" those classes inside the image I created before?
'I have build maven project using java 8 and tomcat 8 and configured sonar with jdk 11. but I am getting below error after running command mvn sonar:sonar
Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project project-name : Unable to execute SonarQube: Fail to get bootstrap index from server: Failed to connect to localhost/0:0:0:0:0:0:0:1:9000: Connection refused
please help'
i am using
D:\project\adaptor>mvn clean install -DskipTests
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
3.2:compile (default-compile) on project adaptor: Compilation failure:
unable to create jar file inside .m2 repository
I want to push the bahir jar to my local m2 repository.
I'm using maven-3.5.0 downloaded tar.gz and jdk8, both are set as environment variables and are working fine.
I built apache bahir for spark from the available download from git using maven, which was BUILD SUCCESS and it created a target folder which has the jar called bahir-parent_2.11-2.3.0-SNAPSHOT-tests.jar
now when I execute:
$mvn install:install-file -Dfile=/home/awisha/trial/bahir-master/target/bahir-parent_2.11-2.3.0-SNAPSHOT-tests.jar -DgroupId=org.apache.bahir -DartifactId=spark-streaming-mqtt_2.11 -Dversion=2.2.0
Its supposed to push the jar to my local .m2/repository. But instead it gives me the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install-file (default-cli) on project standalone-pom: The artifact information is incomplete or not valid:
[ERROR] [0] 'packaging' is missing.
But when I used "apt install maven" : maven-3.3.9, I got BUILD SUCCESS
I'm not able to figure out why is it giving me error when using maven-3.5.0.
You need to simply add "-Dpackaging=jar" to your mvn install:install-file cmd:
$mvn install:install-file -Dpackage=jar
-Dfile=/home/awisha/trial/bahir-master/target/bahir-parent_2.11-2.3.0-SNAPSHOT-tests.jar
-DgroupId=org.apache.bahir -DartifactId=spark-streaming-mqtt_2.11 -Dversion=2.2.0
After building Spark 1.3.0 in the root directory, no matter what command to build examples directory:
mvn -Pyarn -Phadoop-2.4 -Dhadoop.version=2.6.0 -DskipTests clean package
or just:
mvn -DskipTest clean package
I get:
[ERROR] Failed to execute goal org.scalastyle:scalastyle-maven-plugin:0.4.0:check (default) on project spark-examples_2.10: Failed during w: Unable to find configuration file at location scalastyle-config.xml -> [Help 1]
[ERROR]
copy the [spark_root]/scalastyle-config.xml to [spark_root]/examples/scalastyle-config.xml can solve the problem
Copying scalastyle-config.xml into the examples folder from parent folder should solve the issue.
<plugin>
<groupId>org.scalastyle</groupId>
<artifactId>scalastyle-maven-plugin</artifactId>
...
<configLocation>scalastyle-config.xml</configLocation>
The configuration in pom.xml expects the configuration file in the directory maven is invoked from.