Maven: Install external JAR automatically - java

My project has a dependency on oracle jar to connect to it's database. Since it's a external jar, I downloaded it from oracle website and installed it manually using
mvn install:install-file -Dfile=ojdbc8.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.2.0.1 -Dpackaging=jar
running maven clean package on local runs fine, since the ojdbc.jar has been installed.
However, now I am moving the build step to Docker image.
from alpine/git as clone
workdir /app
run git clone --single-branch -b master https://github.com/xxxxxxxx
from maven:3.5-jdk-8-alpine
workdir /app
copy --from=0 /app/idot/idot-backend /app
run mvn clean install -T 1C -DskipTests
from openjdk:8-jre-alpine
workdir /app
copy --from=build /app/target/idot-0.0.1-SNAPSHOT.jar /app
cmd ["java -jar idot-0.0.1-SNAPSHOT.jar"]
This step fails obviously during build since the external jar is not present. So to remove the dependency, I edited the pom.xml to include
<repositories>
<repository>
<id>local-maven-repo</id>
<url>file://${project.basedir}/libs</url>
</repository>
</repositories>
and below dependency remains as before
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency>
and then I deploy the jar file using below command
mvn deploy:deploy-file -Dfile=ojdbc8.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.2.0.1 -Durl=file:./libs/ -DrepositoryId=local-maven-repo
This creates a libs folder with ojdbc8-12.2.0.1.jar and other meta information. I check this folder in github
Now while trying to build the docker image it fails with the below error message.
...
...
.
.
.
Downloaded from central: https://repo.maven.apache.org/maven2/org/liquibase/liquibase-parent/3.6.3/liquibase-parent-3.6.3.pom (31 kB at 39 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc8/12.2.0.1/ojdbc8-12.2.0.1.pom
[WARNING] The POM for com.oracle:ojdbc8:jar:12.2.0.1 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/org/modelmapper/modelmapper/2.3.2/modelmapper-2.3.2.pom
.
.
.
Downloaded from central: https://repo.maven.apache.org/maven2/org/atteo/evo-inflector/1.2.2/evo-inflector-1.2.2.jar (13 kB at 138 B/s)
Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc8/12.2.0.1/ojdbc8-12.2.0.1.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/modelmapper/modelmapper/2.3.2/modelmapper-2.3.2.jar
.
.
.
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/guava/guava/20.0/guava-20.0.jar (2.4 MB at 12 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/io/springfox/springfox-swagger-ui/2.9.2/springfox-swagger-ui-2.9.2.jar (2.9 MB at 14 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy/1.9.12/byte-buddy-1.9.12.jar (3.3 MB at 14 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:13 min (Wall Clock)
[INFO] Finished at: 2020-06-17T11:19:56Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project idot: Could not resolve dependencies for project com.novartis:idot:jar:0.0.1-SNAPSHOT: Could not find artifact com.oracle:ojdbc8:jar:12.2.0.1 in local-maven-repo (file:///app/libs) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
The command '/bin/sh -c mvn clean install -T 1C -DskipTests' returned a non-zero code: 1

Instead of all the headaches, I added the same install command in docker file also. It now works fine.
from alpine/git as clone
workdir /app
run git clone --single-branch -b master https://#github.com/xxxx
from maven:3.5-jdk-8-alpine
workdir /app
copy --from=0 /app/idot/idot-backend /app
run mvn install:install-file -Dfile=/app/ojdbc8.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.2.0.1 -Dpackaging=jar
run mvn clean install -T 1C -DskipTests
from openjdk:8-jre-alpine
workdir /app
copy --from=build /app/target/idot-0.0.1-SNAPSHOT.jar /app
cmd ["java -jar idot-0.0.1-SNAPSHOT.jar"]

I used same approach, Its works for me. You can see here..
<dependencies>
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.4.2-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven-repository</id>
<url>file:///${project.basedir}/repo</url>
</repository>
</repositories>
mvn deploy:deploy-file -Durl="file:\\\<project-path>\repo" -Dfile=Java-WebSocket-1.4.2-SNAPSHOT.jar -DgroupId=org.java-websocket -DartifactId=Java-WebSocket -Dpackaging=jar -Dversion=1.4.2-SNAPSHOT

Related

Docker build unable to find settings.xml

I have problem while reading from settings.xml while docker image creation
Docker file
# syntax=docker/dockerfile:1
FROM eclipse-temurin:17-jre-jammy
COPY .mvn/ .mvn
COPY mvnw pom.xml ./
COPY mvnw settings.xml ./
RUN ./mvnw -s settings.xml dependency: resolve
COPY src ./src
CMD ["./mvnw", "spring-boot:run"]
I tried this docker file also
# syntax=docker/dockerfile:1
FROM eclipse-temurin:17-jre-jammy
COPY .mvn/ .mvn
COPY mvnw ./
COPY pom.xml ./
COPY settings.xml ./
RUN ./mvnw -s settings.xml dependency: resolve
COPY src ./src
CMD ["./mvnw", "spring-boot:run"]
and getting this error:
Could not find goal '' in plugin org.apache.maven.plugins:maven-dependency-plugin:3.3.0 among available goals analyze, analyze-dep-mgt, analyze-duplicate, analyze-only, analyze-report, build-classpath, collect, copy, copy-dependencies, display-ancestors, get, go-offline, help, list, list-classes, list-repositories, properties, purge-local-r
epository, resolve, resolve-plugins, sources, tree, unpack, unpack-dependencies -> [Help 1]
#14 64.62 [ERROR]
#14 64.62 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
#14 64.62 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
#14 64.62 [ERROR]
#14 64.62 [ERROR] For more information about the errors and possible solutions, please read the following articles:
#14 64.62 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoNotFoundException
FROM eclipse-temurin:17-jre-jammy
WORKDIR /app
COPY mvnw .
COPY pom.xml .
# assume settings.xml is in current directory
COPY settings.xml .
RUN mvnw -s settings.xml dependency:resolve
COPY src ./src
CMD ["mvnw", "spring-boot:run"]

Unable to download Java dependencies with Dockerfile

Well, there is this java project using maven, and the pom.xml file is like THIS
When I run locally ./mvnw -B dependency:go-offline and ./mvnw -o package -DskipTests, it works fine. However when I use it in Dockerfile, it just fails on some dependencies...
This is my Dockerfile:
FROM eclipse-temurin:18.0.2.1_1-jdk-focal AS builder
ENV APP=/home/meapi/app
WORKDIR $APP
COPY .mvn .mvn
COPY mvnw pom.xml ./
RUN ./mvnw -B dependency:go-offline
COPY src src
RUN ./mvnw -o package -DskipTests
FROM eclipse-temurin:18.0.2.1_1-jre-focal as dev
RUN addgroup --system meapi && adduser --system --group meapi
ENV spring_profiles_active=development
ENV APP=/home/meapi/app
WORKDIR $APP
RUN chown -R meapi:meapi $APP
USER meapi
COPY --chown=meapi:meapi --from=builder $APP/target/*.jar $APP/app.jar
EXPOSE 8080
ENTRYPOINT [ "java", "-jar", "/usr/meapi/app/app.jar" ]
This is the error:
=> ERROR [builder 7/7] RUN ./mvnw -o package -DskipTests 12.9s
------
> [builder 7/7] RUN ./mvnw -o package -DskipTests:
#14 7.221 [INFO] Scanning for projects...
#14 8.659 [INFO]
#14 8.659 [INFO] ---------------------< com.me:me-api >----------------------
#14 8.660 [INFO] Building me-api 0.0.1-SNAPSHOT
#14 8.660 [INFO] --------------------------------[ jar ]---------------------------------
#14 10.43 [WARNING] The POM for javax.xml.bind:jaxb-api:jar:2.3.1 is missing, no dependency information available
#14 11.03 [WARNING] The POM for com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.13.3 is missing, no dependency information available
#14 11.11 [WARNING] The POM for net.minidev:json-smart:jar:2.4.8 is missing, no dependency information available
#14 11.19 [WARNING] The POM for net.bytebuddy:byte-buddy:jar:1.12.10 is missing, no dependency information available
#14 11.20 [WARNING] The POM for net.bytebuddy:byte-buddy-agent:jar:1.12.10 is missing, no dependency information available
#14 11.35 [WARNING] The POM for org.glassfish.jaxb:jaxb-runtime:jar:2.3.6 is missing, no dependency information available
#14 12.79 [INFO] ------------------------------------------------------------------------
#14 12.79 [INFO] BUILD FAILURE
#14 12.79 [INFO] ------------------------------------------------------------------------
#14 12.82 [INFO] Total time: 5.758 s
#14 12.83 [INFO] Finished at: 2022-09-13T19:58:59Z
#14 12.83 [INFO] ------------------------------------------------------------------------
#14 12.85 [ERROR] Failed to execute goal on project me-api: Could not resolve dependencies for project com.me:me-api:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: javax.xml.bind:jaxb-api:jar:2.3.1, com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.13.3, net.minidev:json-smart:jar:2.4.8, net.bytebuddy:byte-buddy:jar:1.12.10, net.bytebuddy:byte-buddy-agent:jar:1.12.10, org.glassfish.jaxb:jaxb-runtime:jar:2.3.6: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact javax.xml.bind:jaxb-api:jar:2.3.1 has not been downloaded from it before. -> [Help 1]
#14 12.85 [ERROR]
#14 12.85 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
#14 12.85 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
#14 12.85 [ERROR]
#14 12.85 [ERROR] For more information about the errors and possible solutions, please read the following articles:
#14 12.85 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
------
executor failed running [/bin/sh -c ./mvnw -o package -DskipTests]: exit code: 1
The command I use to run it is docker build --no-cache --platform linux/amd64 --tag api --target dev .. How am I supposed to proceed and successfully build the image?

Maven build using org.apache.cxf:cxf-java2ws-plugin:3.3.0:java2ws: Argument list too long

I have a maven project which is building fine on local but failing on gitlab ci/cd pipeline.
The error which is coming as follows:
25869 [INFO] ------------------------------------------------------------------------
925869 [INFO] BUILD FAILURE
925870 [INFO] ------------------------------------------------------------------------
925870 [INFO] Total time: 15:24 min
925871 [INFO] Finished at: 2021-06-08T10:38:11Z
925871 [INFO] ------------------------------------------------------------------------
925891 [ERROR] Failed to execute goal org.apache.cxf:cxf-java2ws-plugin:3.3.0:java2ws (generate-rec-data-service-wsdl) on project descapreusables-server: Error while executing process.
925898 [ERROR] Try to run this goal using <fork>true</fork> and <classpathAsEnvVar>true</classpathAsEnvVar>.
925905 [ERROR] Command line was: /usr/java/openjdk-11/bin/java --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=java.xml/com.sun.org.apache.xerces.internal.impl.xs=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED -DexitOnFinish=true -cp /builds/arcesium/internal/fiatech/.m2/repository/org/apache/cxf/cxf-java2ws-plugin/3.3.0/cxf-java2ws-plugin-3.3.0.jar:/builds/arcesium/internal/fiatech/.m2/repository/com/sun/xml/ws/jaxws-ri/2.3.0/jaxws-ri-2.3.0.pom:/builds/arcesium/internal/fia
The final error is coming as **: Cannot run program "/bin/sh" (in directory "/builds/arcesium/internal/fiatech/performa/descap/DESCap-Reusables/src/modules/server/target"): error=7, Argument list too long**
The command which its building is very huge but on local its not happening.
The gitlab ciYaml file is as :
variables:
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
#MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
#MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
#MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
# This template uses jdk8 for verifying and deploying images
image: maven:3.3.9-jdk-8
stages:
- build
#- test
build:
image: "674283286888.dkr.ecr.us-east-1.amazonaws.com/core-infra/openjdk-maven:3.8.1-openjdk11"
stage: build
tags:
- identity-mnrltdev
#before_script:
# - yum -y install maven
# - mvn -version
script:
- pwd
- ls -ltr
- mvn clean package -DfailIfNoTests=false -Dmaven.test.failure.ignore=true -Dmaven.test.skip=true -s settings.xml
#- mvn clean install -DskipTests=true

Maven install-file not effective in GitLab/Docker: "could not resolve dependencies for project"

I'm trying to build my java project on a GitLab server using Maven in Docker. Because I use 3rd party jars, I install them locally using the install-file plugin. This is/seems succesfull both on my local machine, as on the Docker:
$ mvn install:install-file -Dfile=lib/customArtifact-1.0.jar -DgroupId=customArtifact -DartifactId=customArtifact -Dversion=1.0 -Dpackaging=jar
[INFO] Scanning for 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 to /root/.m2/repository/customArtifact/customArtifact/1.0/customArtifact-1.0.jar
[INFO] Installing /tmp/mvninstall2011198835315637645.pom to /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 the Docker I get this error, which is absent on my local machine:
$ mvn --batch-mode --quiet clean install -DskipTests
[ERROR] Failed to execute goal on project myProject: Could not resolve
dependencies for project groupId:myProject:jar:1.0-SNAPSHOT: Failed to
collect dependencies at customArtifact:customArtifact:jar:1.0: Failed
to read artifact descriptor for customArtifact:customArtifact:jar:1.0:
Could 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 with type default using the available connector
factories: BasicRepositoryConnectorFactory: Cannot access
/builds/gitlab/myProject-groep/myProject/lib using the registered
transporter factories: WagonTransporterFactory: Unsupported
transport protocol -> [Help 1]
I really don't get what is wrong here. Am I missing something in my path, environmental variable? It should be something minor, as I'm literally doing the same locally.
Help is much appreciated!
EDIT:
I'm using this Docker maven:3-jdk-7,
FROM 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 is 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 will install them by default in /.m2/repository. Then mvn clean install will pick them from default repository i.e /.m2/repository.
In docker container
Installing thrid-party libraries using mvn install:install-file will install them in /usr/share/maven/ref/repository (inside the container) as defined in settings-docker.xml. Then mvn clean install will pick them from /usr/share/maven/ref/repository.
The issue is that maven is looking for dependencies in /builds/gitlab/myProject-groep/myProject/lib as defined in pom file, but this directory is not exposed to docker container.
<repositories>
<repository>
<id>myProject_dependencies</id>
<url>${basedir}/lib/</url>
</repository>
</repositories>
Removing repositories section from pom file should resolve the issue.

com.sun:tools:jar:1.4.2 missing when running "perform eclipse" in roo

When I run "perform eclipse" in Roo I get:
roo> perform eclipse
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building bugzter
[INFO] task-segment: [eclipse:clean, eclipse:eclipse]
[INFO] ------------------------------------------------------------------------
[INFO] [eclipse:clean {execution: default-cli}]
[INFO] Deleting file: .project
[INFO] Deleting file: .classpath
[INFO] Deleting file: .wtpmodules
[INFO] Deleting file: .component
[INFO] Deleting file: org.eclipse.wst.common.component
[INFO] Deleting file: org.eclipse.wst.common.project.facet.core.xml
[INFO] Deleting file: org.eclipse.jdt.core.prefs
[INFO] Deleting file: org.eclipse.ajdt.ui.prefs
[INFO] Preparing eclipse:eclipse
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) com.sun:tools:jar:1.4.2
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.codehaus.mojo:aspectj-maven-plugin:maven-plugin:1.0
2) com.sun:tools:jar:1.4.2
----------
1 required artifact is missing.
for artifact:
org.codehaus.mojo:aspectj-maven-plugin:maven-plugin:1.0
from the specified remote repositories:
com.springsource.repository.bundles.release (http://repository.springsource.com/maven/bundles/release),
com.springsource.repository.bundles.external (http://repository.springsource.com/maven/bundles/external),
central (http://repo1.maven.org/maven2),
codehaus.org (http://repository.codehaus.org),
com.springsource.repository.bundles.milestone (http://repository.springsource.com/maven/bundles/milestone),
com.springsource.repository.bundles.snapshot (http://repository.springsource.com/maven/bundles/snapshot),
snapshots (http://snapshots.repository.codehaus.org)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Wed Jul 28 20:57:52 CEST 2010
[INFO] Final Memory: 30M/298M
[INFO] ------------------------------------------------------------------------
Tried downloaded the tools-1.4.2.jar and run mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file but it doesn't solve the problem.
Running ubuntu 10.04 and maven 2.2
Any suggestions?
Repoint your system environment parameter JAVA_HOME to JDK (1.5+) directory instead of JRE.
According to Spring Source Roo and missing com.sun:tools:jar:1.4.2:
If you are trying to get the latest
version of SpringSource ROO working,
with an x64 Java JDK, such as the
latest JDK 1.6 update 20, there is
unfortunately a missing tools.jar from
the default lib\ directory of the JDK
(tut tut tut Sun/Oracle). This will
prevent Roo from working and therefore
prevent Maven compilation. You would
probably see an error similar to this:
Error message: Missing:
----------
1) com.sun:tools:jar:1.4.2
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
----------
1 required artifact is missing.
To correct this error, install an
additional x86 JDK, repoint the
JAVA_HOME and the PATH to the new JDK
and restart the mvn process
i thought i had java_home set to jdk, but i guess in slackware both jre and jdk get installed in same folder. having both installed caused this problem. i uninstalled both, and reinstalled jdk (to be safe) and it fixed it.
Add this dependecy in pom.xml file.
in the <systemPath> property you have to write your JDK lib path.
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.4.2</version>
<scope>system</scope>
<systemPath>C:/Program Files/Java/jdk1.6.0_30/lib/tools.jar</systemPath>
</dependency>
I also had a similar issue and fixed int the following way.
Go to lib directory of JDK installed path in command prompt. Execute the below command to install to install tools.jar. $mvn install:install-file -DgroupId=sun.jdk -DartifactId=tools -Dpackaging=jar -Dversion=1.6 -Dfile=tools.jar
http://parameshk.blogspot.in

Categories

Resources