【发布时间】:2016-06-28 23:21:34
【问题描述】:
我目前正在使用jax-rs 开发一个restful api。项目是一个Maven项目。我需要将mysql-connector-bin.jar 添加到我的项目中。这是生成的pom.xml文件,我添加的jar文件如下。
<modelVersion>4.0.0</modelVersion>
<groupId>com.projects.api</groupId>
<artifactId>messanger</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>messanger</name>
<build>
<finalName>messanger</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>mysql-connector</groupId>
<artifactId>mysql-connector-java-5.1.38-bin</artifactId>
<version>5.1.38</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<!-- use the following artifactId if you don't need servlet 2.x compatibility -->
<!-- artifactId>jersey-container-servlet</artifactId -->
</dependency>
<!-- uncomment this to get JSON support
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
</dependency>
-->
</dependencies>
<properties>
<jersey.version>2.22.2</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
当我运行他的项目时,它显示我添加的 jar 文件找不到类。你对此有什么想法吗?
【问题讨论】:
标签: java mysql xml eclipse maven