To include dependencies in a JAR file with Maven, you can use the maven-assembly-plugin to create an assembly that includes all the dependencies of your project.
上面的pom文件里有两个plugin,第一个是在jar包中的META-INF/MANIFEST.MF中指定Main-Class,指定lib库的jar包依赖classpath;第二个是把依赖到的lib库jar包都复制到配置的classpathPrefix目录下,这一步不做的话运行打出来的jar包会报错,因为相关依赖的jar包虽然配置了classpath但其实该classpath下并没有真实的jar包...
<dependencies> <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> <version>1.2</version> </dependency> </dependencies> 一会我们会用shade插件,将该依赖直接打成uber-jar。 配置shade插件 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-...
最近遇到一个问题,自己直接通过Maven去建立一个SpringBoot项目,最终打包的结果却并不是SpringBoot的打包结果,导致Jar包不能正常通过java -jar启动。 项目依赖很简单,如下面的所示: <?xml version="1.0" encoding="UTF-8"?><projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/...
Maven用仓库外的jar进行编译 之所以采用Maven调用ant 进行编译,是因为有一些lib 并不在远程仓库里,而是直接放到project/lib目录下。 编译的时候要依赖这些lib包, maven里好像没什么办法把这些非仓库里的lib包加入到classpath中来,才采用调用ant的方式。 ps: 但是如果要采用这种把非仓库lib的加入到classpath的方式,就...
version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-resteasy-reactive-jackson</artifactId> </dependency> </dependencies> <repositories> <repository> <id>red-hat-...
[ERROR] Failed to execute goal on project PROJECT_NAME: Could not resolve dependencies for project com.mycompany:project_name:mule:1.0.0: Failed to collect dependencies at your.package:artifact:jar:1.0.0: Failed to read artifact descriptor for your.package:artifact:jar:1.0.0: Could not transfe...
Based on the discussion above, I believe I should not use the default name in maven.install. Should I just use a unique name instead? But I'm worried about the comment above by @shs96c : Inter-ruleset dependencies have to be handled this way because constants cannot be loaded in a ...
In this Maven tutorial, learn about Maven dependency management, including external dependency, transitive dependency tree, excluding dependencies and version ranges. 1. What is Maven Dependency? In Maven, a dependency is just another archive—JAR, ZIP, and so on—which our current project needs in...
System dependencies are commonly utilized to resolve dependencies on artifacts that are supplied by the JDK or VM itself.15. What distinguishes 'maven package' from 'maven install'? The “maven package” command transforms compiled code into a distributable format, typically a JAR file....