2017-07-25 51 views
0

我想用jersey2.25,spring 4,mybatis3.1.1和tomcat創建一個web項目。如何使用jersey2.25,spring 4,mybatis3.1.1創建web項目

我必須使用jdk1.7,以下是我的web項目庫中的所有jar文件。 與那個jar文件,我無法啓動我的tomcat。

所以有人可以幫助創建一個pom.xml文件,以便我可以用maven構建我的web項目?

enter image description here

回答

0

您可以使用Eclipse neon項目開發,首先你需要創建行家ptoject並添加依賴到pom.xml,你可以參考下面的示例代碼。

http://maven.apache.org/xsd/maven-4.0.0.xsd「>

<modelVersion>4.0.0</modelVersion> 
<groupId>com.groupName</groupId> 
<artifactId>artifactName</artifactId> 
<version>0.0.1-SNAPSHOT</version> 
<packaging>war</packaging> 
<name>ProjectName</name> 
<description>ProjectName web api.</description> 

<properties> 
    <jackson.version>2.8.6</jackson.version> 
    <hibernate.version>4.1.8.Final</hibernate.version> 
</properties> 

<repositories> 
    <repository> 
     <id>repository.springframework.maven.release</id> 
     <name>Spring Framework Maven Release Repository</name> 
     <url>http://repo.springsource.org/libs-release</url> 
    </repository> 
</repositories> 

<dependencies> 

    <dependency> 
     <groupId>commons-fileupload</groupId> 
     <artifactId>commons-fileupload</artifactId> 
     <version>1.2</version> 
    </dependency> 
    <dependency> 
     <groupId>com.fasterxml.jackson.core</groupId> 
     <artifactId>jackson-annotations</artifactId> 
     <version>${jackson.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-validator</artifactId> 
     <version>5.2.4.Final</version> 
    </dependency> 
    <dependency> 
     <groupId>javax.validation</groupId> 
     <artifactId>validation-api</artifactId> 
     <version>1.1.0.Final</version> 
    </dependency> 

    <dependency> 
     <groupId>com.fasterxml.jackson.datatype</groupId> 
     <artifactId>jackson-datatype-hibernate4</artifactId> 
     <version>${jackson.version}</version> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-jdbc</artifactId> 
     <version>4.3.5.RELEASE</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-context</artifactId> 
     <version>4.3.5.RELEASE</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-web</artifactId> 
     <version>4.3.5.RELEASE</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-webmvc</artifactId> 
     <version>4.3.5.RELEASE</version> 
    </dependency> 
    <dependency> 
     <groupId>com.fasterxml.jackson.datatype</groupId> 
     <artifactId>jackson-datatype-joda</artifactId> 
     <version>2.5.2</version> 
    </dependency> 
    <dependency> 
     <groupId>org.json</groupId> 
     <artifactId>json</artifactId> 
     <version>20140107</version> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate.javax.persistence</groupId> 
     <artifactId>hibernate-jpa-2.0-api</artifactId> 
     <version>1.0.1.Final</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.data</groupId> 
     <artifactId>spring-data-jpa</artifactId> 
     <version>1.11.0.RELEASE</version> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-core</artifactId> 
     <version>${hibernate.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-entitymanager</artifactId> 
     <version>${hibernate.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-log4j12</artifactId> 
     <version>1.7.22</version> 
    </dependency> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>javax.servlet-api</artifactId> 
     <version>3.1.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>javax.servlet.jsp</groupId> 
     <artifactId>javax.servlet.jsp-api</artifactId> 
     <version>2.3.1</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>jstl</groupId> 
     <artifactId>jstl</artifactId> 
     <version>1.2</version> 
    </dependency> 
    <dependency> 
     <groupId>com.oracle</groupId> 
     <artifactId>ojdbc6</artifactId> 
     <version>11g</version> 
    </dependency> 
    <dependency> 
     <groupId>com.auth0</groupId> 
     <artifactId>java-jwt</artifactId> 
     <version>3.1.0</version> 
    </dependency> 

    <dependency> 
     <groupId>io.jsonwebtoken</groupId> 
     <artifactId>jjwt</artifactId> 
     <version>0.7.0</version> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.security.oauth</groupId> 
     <artifactId>spring-security-oauth2</artifactId> 
     <version>2.0.12.RELEASE</version> 
    </dependency> 

    <dependency> 
     <groupId>org.modelmapper</groupId> 
     <artifactId>modelmapper</artifactId> 
     <version>0.7.5</version> 
    </dependency> 

    <dependency> 
     <groupId>commons-lang</groupId> 
     <artifactId>commons-lang</artifactId> 
     <version>2.6</version> 
    </dependency> 

    <dependency> 
     <groupId>commons-io</groupId> 
     <artifactId>commons-io</artifactId> 
     <version>2.5</version> 
    </dependency> 

    <!-- Test Case Dependency --> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.12</version> 
     <scope>compile</scope> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-test</artifactId> 
     <version>4.3.7.RELEASE</version> 
     <scope>compile</scope> 
    </dependency> 


</dependencies> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.7</source> 
       <target>1.7</target> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

在這個POM你可以用Hibernate和JPA Spring框架。更多你可以參考下面鏈接

http://www.mkyong.com/maven/how-to-create-a-java-project-with-maven/

0

您可以使用名爲春Initializr在線應用程序,可以爲您生成一個春天啓動項目 結構。它不會生成任何應用程序代碼,但它會爲您提供基本項目 結構。

只需訪問:start.spring.io

指定構建工具(Maven的或搖籃),語言,春天引導版本,項目和元數據的依賴關係和下載項目。您還會在下載的文件中找到生成的pom.xml

SPring Initializr Screenshot

相關問題