1. Target
1) Get familiar with baisc maven config.
2) Integrate maven into eclipse.
2. Basic maven config
1) Download maven from http://maven.apache.org/download.cgi and choose Maven 3.0.5 (Binary zip)
2) Unzip maven.
3) Set environment variables in windows
1) add MAVEN_HOME with value D:\Program Files\apache-maven-3.0.5
2) add PATH with value %MAVEN_HOME%\bin
4) Type mvn -version in CMD to test whether the variables have been set correctly.
3. A glimpse of maven dirs
1) In conf/settings.xml, we can config proxies and repository for maven. This config file is global scope config.
2) The default location for maven respository is C:/Users/Administrator/.m2/repository.
2) C:/Users/Administrator/.m2/settings.xml is user scope config. <We need to copy golbal setting.xml to this folder as this file doesn't exists at start up>
4. A simple example using maven without IDE
1) First we create a folder: D:/workspace/maven as the root folder for our project.
2) In the folder maven, we create a simple 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.0</modelVersion> <groupId>edu.xmu.maven</groupId> <artifactId>MavenExample-ModuleOn</artifactId> <packaging>jar</packaging> <version>0.0.1-SNAPSHOT</version> </project>
1) groupId---> Means the project name.
2) artifactId ---> Means a single module inside the project.
3) packaging ---> jar/war
4) modelVersion ---> Must be set as 4.0.0
5) version ---> SNAPSHOT means not RELEASE version. May be changed quite often.
3) In the folder D:/workspace/maven/src/main/java, we manually create a dir edu/xmu/maven
4) In the path D:\workspace\maven\src\main\java\edu\xmu\maven we create a Test.java file
package edu.xmu.maven; public class Test { public void sayHello(String name) { System.out.println("Hello, " + name); } }
5) In CMD, type command as below
1) We have to make sure the proxy is configured correctly in settings.xml ----> Use ping repo1.maven.org to validate if we can connect to main respository.
2) We have to make sure the JAVA_HOME is configured as jdk main folder and not as jre main folder ---> Or else, build failure occurs.
6) Inspect the compile output folder: D:\workspace\maven\target\classes
7) The destination .class file is generated as D:\workspace\maven\target\classes\edu\xmu\maven\Test.class
5. A glimpse of installed directory hierarchy after we type mvn install in CMD
1) The .jar is released as C:\Users\Administrator\.m2\repository\edu\xmu\maven\MavenExample-ModuleOne\0.0.1-SNAPSHOT\MavenExample-ModuleOne-0.0.1-SNAPSHOT.jar
2) The C:\Users\Administrator\.m2\repository is the default position we publish/install our project.
3) The \edu\xmu\maven\MavenExample-ModuleOne\0.0.1-SNAPSHOT means groupId + artifactId + version <different groupId means different project, diffetent artifactId means different module in one project>
4) The MavenExample-ModuleOne-0.0.1-SNAPSHOT.jar means artifactId + version.
6. A simple introduction of maven dir
7. A simple introducition of maven command
mvn archetype:create :Create Maven project
mvn compile :Compile source code
mvn test-compile :Compile test source code
mvn test : Run unit test
mvn site : Generate related sites
mvn clean :Clean generated target folder
mvn package : Generate .jar file
mvn install :Install .jar/.war into local maven Repository
mvn deploy:Deploy .jar/.war into remote repository
mvn eclipse:eclipse :Generate eclipse project file
相关推荐
Maven更新问题 今天Maven在更新的时候发现一直更新不成功,总结下解决方法。 在apache-maven-3.5.2/conf/setting.xml中加入以下配置即可解决 alimaven aliyun maven ...
Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project
idea创建Maven项目时,报错显示Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.0.2:resources,并且Maven插件内看不到 mybatis-generator。如下图: 折腾了好久发现配置放错地方了,...
MAVEN安装包:apache-maven-3.0.5.zip
Maven 教程:基础篇——尚硅谷学习笔记 2022年
maven-install-plugin-2.4.jar
Over 90 hands-on recipes to successfully build and automate development life cycle tasks following Maven conventions and best practices About This Book Understand the features of Apache Maven that ...
It starts with the core Maven concepts and its architecture, and then explains how to build extensions such as plugins, archetypes, and lifecycles in depth. This book is a step-by-step guide that ...
自己实现的自定义maven插件:可以根据配置的接口类和参数类,生成对应的word版本的API文档。还可以自定义自己的模板文件。
maven版本
Apache Maven是一个软件项目管理和理解工具。 基于项目对象模型(POM)的概念,Maven可以从中心信息中管理项目的构建、报告和文档。
一、错误原因 1.jdk版本过低:maven最新版本支持Java7及以上...3.出现历史版本页面,我选择了3.6.1 选择二进制版本,点击 4.IDEA中重新配置maven File–>Settings–>搜索maven,如下图配置即可 作者:Think—Coder
赠送jar包:spring-security-config-5.5.2.jar; 赠送原API文档:spring-security-config-5.5.2-javadoc.jar; 赠送源代码:spring-security-config-5.5.2-sources.jar; 赠送Maven依赖信息文件:spring-security-...
如何输入关键字,寻找需要依赖jar的MAVEN坐标,需要提供确切的MAVEN坐标 1.Sonatype Nexus 地址: https://repository.sonatype.org 2. Jarvana 地址: http://www.jarvana.com/jarvana 3.MVNbrowser 地址: ...
赠送jar包:spring-security-config-5.2.0.RELEASE.jar; 赠送原API文档:spring-security-config-5.2.0.RELEASE-javadoc.jar; 赠送源代码:spring-security-config-5.2.0.RELEASE-sources.jar; 赠送Maven依赖信息...
NULL 博文链接:https://waddy.iteye.com/blog/1990279
赠送Maven依赖信息文件:config-1.2.1.pom; 包含翻译后的API文档:config-1.2.1-javadoc-API文档-中文(简体)版.zip; Maven坐标:com.typesafe:config:1.2.1; 标签:typesafe、config、中文文档、jar包、java; ...
赠送jar包:spring-security-config-5.6.1.jar; 赠送原API文档:spring-security-config-5.6.1-javadoc.jar; 赠送源代码:spring-security-config-5.6.1-sources.jar; 赠送Maven依赖信息文件:spring-security-...
Maven: The Complete Reference The essential reference for anyone working with Apache Maven. Explore the details of the POM, Maven Settings, Maven Archetypes.
赠送jar包:spring-security-config-3.2.3.RELEASE.jar; 赠送原API文档:spring-security-config-3.2.3.RELEASE-javadoc.jar; 赠送源代码:spring-security-config-3.2.3.RELEASE-sources.jar; 赠送Maven依赖信息...