IDEAでのMaven管理によるmysql依存の追加
10793 ワード
Java Webプロジェクトを行う場合、データベースに使用することは避けられません.IDEAにmysql依存を追加する方法です.
ここを見たらIDEA、maven、Tomcatなどがわかったので...
pomでxmlに依存を追加すればいいです.次は私のプロファイルです.
赤い領域はmysql依存コードを追加しますよ.バージョンが異なる場合は、versionで変更できます.
依存を追加すると、IDEAが必要なjarパッケージを自動的にダウンロードしてくれますよ!
転載先:https://www.cnblogs.com/suixue/p/5687764.html
ここを見たらIDEA、maven、Tomcatなどがわかったので...
pomでxmlに依存を追加すればいいです.次は私のプロファイルです.
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.0modelVersion>
<groupId>com.suixuegroupId>
<artifactId>exampleartifactId>
<version>1.0-SNAPSHOTversion>
<dependencies>
<dependency>
<groupId>junitgroupId>
<artifactId>junitartifactId>
<version>4.11version>
<type>jartype>
<scope>testscope>
dependency>
<dependency>
<groupId>org.springframeworkgroupId>
<artifactId>spring-contextartifactId>
<version>4.1.6.RELEASEversion>
<type>jartype>
dependency>
<dependency>
<groupId>log4jgroupId>
<artifactId>log4jartifactId>
<version>1.2.17version>
<type>jartype>
dependency>
<dependency>
<groupId>com.fasterxml.jackson.coregroupId>
<artifactId>jackson-coreartifactId>
<version>2.2.1version>
dependency>
<dependency>
<groupId>com.fasterxml.jackson.coregroupId>
<artifactId>jackson-databindartifactId>
<version>2.1.3version>
dependency>
<dependency>
<groupId>com.fasterxml.jackson.coregroupId>
<artifactId>jackson-annotationsartifactId>
<version>2.1.2version>
dependency>
mysql
mysql-connector-java
5.1.25
dependencies>
project>
赤い領域はmysql依存コードを追加しますよ.バージョンが異なる場合は、versionで変更できます.
依存を追加すると、IDEAが必要なjarパッケージを自動的にダウンロードしてくれますよ!
転載先:https://www.cnblogs.com/suixue/p/5687764.html