Answer the question
In order to leave comments, you need to log in
When building a project via MAVEN, the JDBC driver flies off, how to pack it together with the project?
After building the project with the build command into a jar file, the program stops seeing jdbc. The driver is added as a library in IDEA.
Here is the pom file itself:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>usapedia</groupId>
<artifactId>Usapedia</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.40</version>
</dependency>
</dependencies>
<build>
<finalName>Usapedia</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<archive>
<manifest>
<!-- Jar file entry point -->
<mainClass>Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Answer the question
In order to leave comments, you need to log in
Solved the problem with packing all dependencies into a jar file with the shade plugin maven.apache.org/plugins/maven-shade-plugin
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question