0

Wenn i do in eclipse a maven build with maven install no 3rd party jar is delivered. in my poms i have the dependency added, e.g:

<project>
<dependencies>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.9</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.29</version>
    </dependency>
</dependencies>
</project>

but after running the main.jar of my maven projects i get

java.sql.SQLException: No suitable driver found for jdbc:mysql:

What I'm doing wrong.

ohlmar
  • 958
  • 8
  • 17
user1829716
  • 307
  • 1
  • 9
  • 20
  • Apparently the mysql jar is not on the runtime classpath of your application, for whatever reason. Either that or the JDBC URL which you are not posting is very wrong. Show some code. – Gimby Feb 13 '14 at 14:42
  • What do you mean with "delivered"? `mvn install` just fetches the dependencies to your local `.m2/..` and uses that for building your software. Maybe you want the maven-exec-plugin: http://stackoverflow.com/questions/2472376/how-do-i-execute-a-program-using-maven – Gyro Gearless Feb 13 '14 at 14:57

1 Answers1

0

Everything should be installed if you've run the proper command. Try running

 mvm clean install

before you try to build your project. Then afterwards try running

mvm compile
j.jerrod.taylor
  • 1,120
  • 1
  • 13
  • 33
  • There is no such thing as a lifecycle phase "build", at least not in `mvn` – Gyro Gearless Feb 13 '14 at 14:53
  • @GyroGearless I changed it to compile. I always forget whether it is build or compile so I usually just try one. Since OP mentioned "build" in their original post I just assumed that was the correct one. – j.jerrod.taylor Feb 13 '14 at 14:58
  • 1
    Now better :-) But i suppose the second invocation is somewhat redundant, as `install` includes `compile` anyway - you cannot do an `install` without passing through the `compile` phase, see http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference – Gyro Gearless Feb 13 '14 at 15:03