美文网首页
对于maven的理解

对于maven的理解

作者: dependmyse | 来源:发表于2016-06-15 16:27 被阅读0次

最近来到新公司发现大家都在使用maven对java进行项目的构建,将最近一段时间的感悟记录下来....(ps,idea真的比eclipse要更好用啊)

maven是干什么的

个人感觉maven解放了我们对于项目构建的过程,更高级的功能还没有接触到,就现在而言感觉其主要对于项目的发布有着很大的帮助
我们不用再发布时将我们所需要的包整个发布了,给予配置文件进行发布。这也是一种趋势吧,最近接触到的Python的工程会有一个pip的requirements,npm同样支持批量安装依赖。

一旦我们进行完依赖项的配置以后,其余的开发跟正常开发一样

idea构建spring mvc工程

http://www.cnblogs.com/jifeng/p/4658765.html

这里有一点我们需要特别注意: 当我们在配置artifacts选项的时候,我们一定要正确选择好我们的output directory目录位置,这对我们接下来配置output layout选项有着很大的作用。

下面贴出spring mvc的pom文件

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
-->
<!-- $Id: pom.xml 642118 2008-03-28 08:04:16Z reinhard $ -->
<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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <packaging>war</packaging>

  <name>TjuKnowledge</name>
  <groupId>com.tju.knowledge</groupId>
  <artifactId>TjuKnowledge</artifactId>
  <version>1.0-SNAPSHOT</version>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <springversion>3.1.1.RELEASE</springversion>
    <junitversion>3.8.1</junitversion>
  </properties>
  <dependencies>
    <!--dependency>
      <groupId>com.tju.knowledge</groupId>
      <artifactId>[the artifact id of the block to be mounted]</artifactId>
      <version>1.0-SNAPSHOT</version>
    </dependency-->
    <!-- JUnit配置 -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junitversion}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-aop</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-asm</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-aspects</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context-support</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-expression</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jms</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-orm</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-oxm</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-tx</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <version>${springversion}</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
      <version>3.1</version>
    </dependency>

    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.1</version>
    </dependency>
  </dependencies>

</project>

demo controller代码

package com.tju.Controler;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.tju.domain.Book;

@Controller
@RequestMapping("/book.do")
public class HelloControler {

    @RequestMapping(params = "method=add")
    public String add(Book book){
        System.out.println("bookname:"+book.getBookName());
        System.out.println("author:"+book.getBookId());
        return "success";
    }
    @RequestMapping(params = "method=update")
    public String update(Book book) {
        return "success";
    }

}

相关文章

  • 对于maven的理解

    最近来到新公司发现大家都在使用maven对java进行项目的构建,将最近一段时间的感悟记录下来....(ps,id...

  • Maven的理解

    Maven,用于团队式开发的工具,需要在开发工具中载入,以下谈谈自己的见解。Maven主要有两个作用,一个是项目构...

  • maven理解

    特别细 什么是maven? maven是一种java构建工具。1)管理jar资源:自然还能够管理jar与jar之间...

  • Maven学习笔记(一)

    对Maven的理解 先来看下Maven官网的定义: IntroductionMaven, a Yiddish wo...

  • CentOS7 安装Maven3.6.1详解

    1、什么是Maven Apache Maven是一个软件项目管理和理解工具。Maven基于项目对象模型(POM)的...

  • Maven学习

    简介 maven对于Java相当于cocoaPods对于iOS。 官网:http://maven.apache.o...

  • maven

    这家伙可以理解为java 版 cocoapods, 但是maven相对于java的第三方框架来说又和 cocoap...

  • maven仓库理解

    前言 使用maven也有一段时间,经常发现有些jar包拉取不到,所以整理出比较详细的maven仓库优先级,更加深层...

  • 彻底理解maven

    前言 最近解决jar包冲突问题时,很头疼,发现自己对maven的理解太肤浅了,很多细节都一知半解,于是最近又学习了...

  • 全面理解 Maven

    1 简介 本文将介绍基于 Apache Maven 3 的项目构建的基本概念和方法。Maven 是一套标准的项目构...

网友评论

      本文标题:对于maven的理解

      本文链接:https://www.haomeiwen.com/subject/jkkpdttx.html