简体   繁体   中英

Suppress maven dependency version suffix in local repository

I have a Spring Boot project that uses SAP Crystal Reports. CR is not published in Maven Central. I imported all of the CR jar files into my Maven local repository. In my projects the jars have the version appended to the jar file name. For one jar file, this causes a runtime error. How can I have that jar not have the appended Maven version?

if you build from source using Maven then you can override the artifact final name in the POM of this project

 <finalName>myJar</finalName>

If you run the mvn install manually then you have control of what you store into the Maven repository

 mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

This is my workaround hack.

The Jar is question is never directly referenced by my project code, it is a runtime library of the Crystal Reports java runtime. I do not need it in the classpath at build time, just in the deployed file built by maven.

My Spring Boot project is deployed as a WAR file so I need to structure my Eclipse Maven project so that the Jar is placed in WEB-INF/lib as a plain web app resource. I do not specify the jar as a maven dependency.

It's a hack because the jar file IS a dependency and SHOULD be specified as a maven project dependency in the pom.xml.

This solves my immediate problem. I blame SAP for not considering Maven for their Crystal Reports Java runtime.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM