一、基于maven脚手架创建新的项目(如何生成maven脚手架本文后面会有详细说明):
1、在maven的本地环境(比如C:\Users\dell\.m2)下新建文件archetype-catalog.xml,其中version的值按照实际情况填入:
<?xml version="1.0" encoding="UTF-8"?> <archetype-catalog xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0 http://maven.apache.org/xsd/archetype-catalog-1.0.0.xsd" xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <archetypes> <archetype> <groupId>com.fangdd.cosmos</groupId> <artifactId>cosmos-archetype</artifactId> <version>1.0.1</version> <description>cosmos-archetype</description> </archetype> </archetypes> </archetype-catalog>
2、进入到要生成的项目的目录下(比如D:\temp):
cd /D/temp
3、执行命令mvn archetype:generate -DarchetypeCatalog=local,展示本地local已有的maven脚手架:
dell@DELL-PC /D/temp $ mvn archetype:generate -DarchetypeCatalog=local [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethrea ded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> maven-archetype-plugin:2.3:generate (default-cli) @ standalone-pom >> > [INFO] [INFO] <<< maven-archetype-plugin:2.3:generate (default-cli) @ standalone-pom << < [INFO] [INFO] --- maven-archetype-plugin:2.3:generate (default-cli) @ standalone-pom -- - [INFO] Generating project in Interactive mode [INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven. archetypes:maven-archetype-quickstart:1.0) Choose archetype: 1: local -> com.fangdd.cosmos:cosmos-archetype (cosmos-archetype) Choose a number or apply filter (format: [groupId:]artifactId, case sensitive co ntains): :
4、在结果中选择cosmos-archetype的序号,本范例中为:1,然后按照系统提示逐步输入groupId、artifactId、version、package四个必需的属性,
其中version、package系统会智能给出一个默认值,回车确认后系统就会生成新的maven项目了:
Choose archetype: 1: local -> com.fangdd.cosmos:cosmos-archetype (cosmos-archetype) Choose a number or apply filter (format: [groupId:]artifactId, case sensitive co ntains): : 1 Define value for property 'groupId': : com.fangdd.creditloan Define value for property 'artifactId': : creditloan Define value for property 'version': 1.0-SNAPSHOT: : Define value for property 'package': com.fangdd.creditloan: : Confirm properties configuration: groupId: com.fangdd.creditloan artifactId: creditloan version: 1.0-SNAPSHOT package: com.fangdd.creditloan Y: : y [INFO] ------------------------------------------------------------------------- --- [INFO] Using following parameters for creating project from Archetype: cosmos-ar chetype:1.0.1 [INFO] ------------------------------------------------------------------------- --- [INFO] Parameter: groupId, Value: com.fangdd.creditloan [INFO] Parameter: artifactId, Value: creditloan [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] Parameter: package, Value: com.fangdd.creditloan [INFO] Parameter: packageInPathFormat, Value: com/fangdd/creditloan [INFO] Parameter: package, Value: com.fangdd.creditloan [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] Parameter: groupId, Value: com.fangdd.creditloan [INFO] Parameter: artifactId, Value: creditloan [INFO] Parent element not overwritten in d:\temp\creditloan\creditloan-util\pom. xml [INFO] Parent element not overwritten in d:\temp\creditloan\creditloan-base\pom. xml [INFO] Parent element not overwritten in d:\temp\creditloan\creditloan-dao\pom.x ml [INFO] Parent element not overwritten in d:\temp\creditloan\creditloan-service\p om.xml [INFO] Parent element not overwritten in d:\temp\creditloan\creditloan-auth\pom. xml [INFO] Parent element not overwritten in d:\temp\creditloan\creditloan-web\pom.x ml [INFO] project created from Archetype in dir: d:\temp\creditloan [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 43.330 s [INFO] Finished at: 2015-04-24T10:31:43+08:00 [INFO] Final Memory: 14M/226M [INFO] ------------------------------------------------------------------------
二、如何生成maven脚手架,比如本文上面使用的cosmos-archetype:
脚手架也叫工程模板,就是创建一个或多个默认的工程并为每个工程填充好默认的一些文件和配置。同时要抽象出生成的工程需要的一些属性,做到这些属性可动态配置。在maven里通过定制的archetype来生成脚手架。maven本身内置了很多archetype 工程模板。通过
mvn archetype:generate
命令,mvn会列举出支持的所有项目模板。可以根据需求选择一个模板生成项目工程。如果这些默认的模板还不够用,或者公司内部还希望定制自己个性化的工程模板,可以自己制作工程模板。
1、首先你已经有了一个配置好的工程,比如cosmos-template:
<modelVersion>4.0.0</modelVersion> <groupId>com.fangdd.cosmos</groupId> <artifactId>cosmos</artifactId> <packaging>pom</packaging> <version>1.0.1-SNAPSHOT</version> <name>cosmos</name> <url>http://www.fangdd.com</url> <modules> <module>cosmos-util</module> <module>cosmos-base</module> <module>cosmos-dao</module> <module>cosmos-service</module> <module>cosmos-auth</module> <module>cosmos-web</module> </modules>
2、进入cosmos-template目录,执行命令生成脚手架cosmos-archetype:
mvn archetype:create-from-project
结果:
dell@DELL-PC /D/angular/cosmos-template (master) $ mvn archetype:create-from-project [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.fangdd.cosmos:cosmos-base:jar:1.0.1-SNAPSHOT [WARNING] 'version' contains an expression but should be a constant. @ com.fangd d.cosmos:cosmos-base:${parent.version}, D:\angular\cosmos-template\cosmos-base\p om.xml, line 10, column 12 [WARNING] The expression ${parent.version} is deprecated. Please use ${project.p arent.version} instead. @ com.fangdd.cosmos:cosmos-base:${parent.version}, D:\an gular\cosmos-template\cosmos-base\pom.xml [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten t he stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support buildin g such malformed projects. [WARNING] [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] cosmos [INFO] cosmos-util [INFO] cosmos-base [INFO] cosmos-dao [INFO] cosmos-service [INFO] cosmos-auth [INFO] cosmos-web [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethrea ded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building cosmos 1.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> maven-archetype-plugin:2.3:create-from-project (default-cli) @ cosmos >>> [INFO] [INFO] <<< maven-archetype-plugin:2.3:create-from-project (default-cli) @ cosmos <<< [INFO] [INFO] --- maven-archetype-plugin:2.3:create-from-project (default-cli) @ cosmos --- [INFO] Setting default groupId: com.fangdd.cosmos [INFO] Setting default artifactId: cosmos [INFO] Setting default version: 1.0.1-SNAPSHOT [INFO] Setting default package: com.fangdd.cosmos Scanned 0 filtered files in 1 files: Scanned 1 filtered files in 2 files: .project Scanned 8 filtered files in 8 files: src\main\java\com\fangdd\cosmos\util\codec\ MD5.java, src\main\java\com\fangdd\cosmos\util\Dates.java, src\main\java\com\fan gdd\cosmos\util\entity\Entities.java, src\main\java\com\fangdd\cosmos\util\excep tion\BusinessException.java, src\main\java\com\fangdd\cosmos\util\page\PageQueri er.java, src\main\java\com\fangdd\cosmos\util\page\Pages.java, src\main\java\com \fangdd\cosmos\util\response\Response.java, src\main\java\com\fangdd\cosmos\util \response\ResultCode.java Scanned 3 filtered files in 3 files: src\test\java\com\fangdd\cosmos\test\Test.j ava, src\test\java\com\fangdd\cosmos\test\util\codec\MD5Test.java, src\test\java \com\fangdd\cosmos\test\util\entity\EntiesTest.java Scanned 1 filtered files in 6 files: .settings\org.eclipse.wst.common.project.fa cet.core.xml Scanned 2 filtered files in 3 files: .classpath, .project Scanned 19 filtered files in 19 files: src\main\java\com\fangdd\cosmos\base\cont roller\AbstractController.java, src\main\java\com\fangdd\cosmos\base\dao\Abstrac tDao.java, src\main\java\com\fangdd\cosmos\base\entity\Permit.java, src\main\jav a\com\fangdd\cosmos\base\entity\PermitExample.java, src\main\java\com\fangdd\cos mos\base\entity\Role.java, src\main\java\com\fangdd\cosmos\base\entity\RoleExamp le.java, src\main\java\com\fangdd\cosmos\base\entity\RolePermit.java, src\main\j ava\com\fangdd\cosmos\base\entity\RolePermitExample.java, src\main\java\com\fang dd\cosmos\base\entity\RolePermitKey.java, src\main\java\com\fangdd\cosmos\base\e ntity\User.java, src\main\java\com\fangdd\cosmos\base\entity\UserExample.java, s rc\main\java\com\fangdd\cosmos\base\entity\UserRole.java, src\main\java\com\fang dd\cosmos\base\entity\UserRoleExample.java, src\main\java\com\fangdd\cosmos\base \entity\UserRoleKey.java, src\main\java\com\fangdd\cosmos\base\model\AbstractMod el.java, src\main\java\com\fangdd\cosmos\base\model\RolePermitModel.java, src\ma in\java\com\fangdd\cosmos\base\model\UserModel.java, src\main\java\com\fangdd\co smos\base\model\UserRoleModel.java, src\main\java\com\fangdd\cosmos\base\service \AbstractService.java Scanned 1 filtered files in 6 files: .settings\org.eclipse.wst.common.project.fa cet.core.xml Scanned 2 filtered files in 3 files: .classpath, .project Scanned 5 filtered files in 5 files: src\main\java\com\fangdd\cosmos\demo\dao\im pl\PersonDaoImpl.java, src\main\java\com\fangdd\cosmos\demo\dao\PersonDao.java, src\main\java\com\fangdd\cosmos\demo\entity\Person.java, src\main\java\com\fangd d\cosmos\demo\entity\PersonExample.java, src\main\java\com\fangdd\cosmos\demo\ma pper\PersonMapper.java Scanned 2 filtered files in 2 files: src\main\resources\mybatis\cosmos\PersonMap per.xml, src\main\resources\mybatis\mybatis-config.xml Scanned 1 filtered files in 1 files: src\test\java\com\fangdd\cosmos\test\Test.j ava Scanned 1 filtered files in 6 files: .settings\org.eclipse.wst.common.project.fa cet.core.xml Scanned 2 filtered files in 3 files: .classpath, .project Scanned 3 filtered files in 3 files: src\main\java\com\fangdd\cosmos\demo\servic e\impl\PersonServiceImpl.java, src\main\java\com\fangdd\cosmos\demo\service\Pers onService.java, src\main\java\com\fangdd\cosmos\service\Test.java Scanned 1 filtered files in 1 files: src\test\java\com\fangdd\cosmos\test\Test.j ava Scanned 1 filtered files in 6 files: .settings\org.eclipse.wst.common.project.fa cet.core.xml Scanned 2 filtered files in 3 files: .classpath, .project Scanned 35 filtered files in 35 files: src\main\java\com\fangdd\cosmos\auth\cont roller\LoginController.java, src\main\java\com\fangdd\cosmos\auth\controller\Per mitController.java, src\main\java\com\fangdd\cosmos\auth\controller\RoleControll er.java, src\main\java\com\fangdd\cosmos\auth\controller\RolePermitController.ja va, src\main\java\com\fangdd\cosmos\auth\controller\UserController.java, src\mai n\java\com\fangdd\cosmos\auth\controller\UserRoleController.java, src\main\java\ com\fangdd\cosmos\auth\dao\impl\PermitDaoImpl.java, src\main\java\com\fangdd\cos mos\auth\dao\impl\RoleDaoImpl.java, src\main\java\com\fangdd\cosmos\auth\dao\imp l\RolePermitDaoImpl.java, src\main\java\com\fangdd\cosmos\auth\dao\impl\UserDaoI mpl.java, src\main\java\com\fangdd\cosmos\auth\dao\impl\UserRoleDaoImpl.java, sr c\main\java\com\fangdd\cosmos\auth\dao\PermitDao.java, src\main\java\com\fangdd\ cosmos\auth\dao\RoleDao.java, src\main\java\com\fangdd\cosmos\auth\dao\RolePermi tDao.java, src\main\java\com\fangdd\cosmos\auth\dao\UserDao.java, src\main\java\ com\fangdd\cosmos\auth\dao\UserRoleDao.java, src\main\java\com\fangdd\cosmos\aut h\form\LoginForm.java, src\main\java\com\fangdd\cosmos\auth\mapper\PermitMapper. java, src\main\java\com\fangdd\cosmos\auth\mapper\RoleMapper.java, src\main\java \com\fangdd\cosmos\auth\mapper\RolePermitMapper.java, src\main\java\com\fangdd\c osmos\auth\mapper\UserMapper.java, src\main\java\com\fangdd\cosmos\auth\mapper\U serRoleMapper.java, src\main\java\com\fangdd\cosmos\auth\service\impl\PermitServ iceImpl.java, src\main\java\com\fangdd\cosmos\auth\service\impl\RolePermitServic eImpl.java, src\main\java\com\fangdd\cosmos\auth\service\impl\RoleServiceImpl.ja va, src\main\java\com\fangdd\cosmos\auth\service\impl\UserRoleServiceImpl.java, src\main\java\com\fangdd\cosmos\auth\service\impl\UserServiceImpl.java, src\main \java\com\fangdd\cosmos\auth\service\LoginService.java, src\main\java\com\fangdd \cosmos\auth\service\PermitService.java, src\main\java\com\fangdd\cosmos\auth\se rvice\RolePermitService.java, src\main\java\com\fangdd\cosmos\auth\service\RoleS ervice.java, src\main\java\com\fangdd\cosmos\auth\service\UserRoleService.java, src\main\java\com\fangdd\cosmos\auth\service\UserService.java, src\main\java\com \fangdd\cosmos\auth\shiro\ShiroDbRealm.java, src\main\java\com\fangdd\cosmos\aut h\velocity\ShiroTool.java Scanned 26 filtered files in 591 files: src\main\resources\applicationContext.xm l, src\main\resources\mybatis\cosmos\PermitMapper.xml, src\main\resources\mybati s\cosmos\RoleMapper.xml, src\main\resources\mybatis\cosmos\RolePermitMapper.xml, src\main\resources\mybatis\cosmos\UserMapper.xml, src\main\resources\mybatis\co smos\UserRoleMapper.xml, src\main\resources\spring-shiro.xml, src\main\webapp\vi ews\auth\permit\list.vm, src\main\webapp\views\auth\role\list.vm, src\main\webap p\views\auth\user\list.vm, src\main\webapp\views\error\404.jsp, src\main\webapp\ views\error\500.jsp, src\main\webapp\views\error\error.jsp, src\main\webapp\view s\error\exception.jsp, src\main\webapp\views\error\message.jsp, src\main\webapp\ views\error\nopermit.vm, src\main\webapp\views\login.vm, src\main\webapp\views\r esource_ace.jsp, src\main\webapp\views\resource_ace.vm, src\main\webapp\views\re source_basic.jsp, src\main\webapp\views\resource_basic.vm, src\main\webapp\views \sucess.vm, src\main\webapp\WEB-INF\spring-mvc.xml, src\main\webapp\WEB-INF\velo city.properties, src\main\webapp\WEB-INF\velocityToolBox.xml, src\main\webapp\WE B-INF\web.xml Scanned 2 filtered files in 2 files: src\test\java\com\fangdd\cosmos\test\genera tor\PermitSqlGenerator.java, src\test\java\com\fangdd\cosmos\test\Test.java Scanned 2 filtered files in 10 files: .settings\org.eclipse.wst.common.project.f acet.core.prefs.xml, .settings\org.eclipse.wst.common.project.facet.core.xml Scanned 2 filtered files in 3 files: .classpath, .project Scanned 2 filtered files in 2 files: src\main\java\com\fangdd\cosmos\demo\contro ller\PersonController.java, src\main\java\com\fangdd\cosmos\Test.java Scanned 11 filtered files in 14 files: src\main\resources\environment\developmen t\application.properties, src\main\resources\environment\development\jdbc.proper ties, src\main\resources\environment\development\logback.xml, src\main\resources \environment\production\application.properties, src\main\resources\environment\p roduction\jdbc.properties, src\main\resources\environment\production\logback.xml , src\main\resources\environment\testing\application.properties, src\main\resour ces\environment\testing\jdbc.properties, src\main\resources\environment\testing\ logback.xml, src\main\webapp\views\index.vm, src\main\webapp\WEB-INF\web.xml Scanned 1 filtered files in 1 files: src\test\java\com\fangdd\cosmos\test\Test.j ava Scanned 1 filtered files in 9 files: .settings\org.eclipse.wst.common.project.fa cet.core.xml Scanned 2 filtered files in 3 files: .classpath, .project [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethrea ded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building cosmos-archetype 1.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] Downloading: http://192.168.1.60:8081/nexus/content/groups/public/org/apa che/maven/plugins/maven-install-plugin/maven-metadata.xml [INFO] Downloaded: http://192.168.1.60:8081/nexus/content/groups/public/org/apac he/maven/plugins/maven-install-plugin/maven-metadata.xml (751 B at 0.2 KB/sec) [INFO] Downloading: http://192.168.1.60:8081/nexus/content/groups/public/org/apa che/maven/plugins/maven-resources-plugin/maven-metadata.xml [INFO] Downloaded: http://192.168.1.60:8081/nexus/content/groups/public/org/apac he/maven/plugins/maven-resources-plugin/maven-metadata.xml (805 B at 0.0 KB/sec) [INFO] Downloading: http://192.168.1.60:8081/nexus/content/groups/public/org/apa che/maven/plugins/maven-deploy-plugin/maven-metadata.xml [INFO] Downloaded: http://192.168.1.60:8081/nexus/content/groups/public/org/apac he/maven/plugins/maven-deploy-plugin/maven-metadata.xml (837 B at 0.2 KB/sec) [INFO] [INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ cosmos-arc hetype --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e . build is platform dependent! [INFO] Copying 749 resources [INFO] [INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ co smos-archetype --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e . build is platform dependent! [INFO] Copying 2 resources [INFO] [INFO] --- maven-archetype-plugin:2.3:jar (default-jar) @ cosmos-archetype --- [INFO] Building archetype jar: D:\angular\cosmos-template\target\generated-sourc es\archetype\target\cosmos-archetype-1.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 27.437 s [INFO] Finished at: 2015-04-24T11:11:25+08:00 [INFO] Final Memory: 15M/154M [INFO] ------------------------------------------------------------------------ [INFO] Archetype created in d:\angular\cosmos-template\target\generated-sources\ archetype [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] cosmos ............................................ SUCCESS [ 30.767 s] [INFO] cosmos-util ....................................... SKIPPED [INFO] cosmos-base ....................................... SKIPPED [INFO] cosmos-dao ........................................ SKIPPED [INFO] cosmos-service .................................... SKIPPED [INFO] cosmos-auth ....................................... SKIPPED [INFO] cosmos-web ........................................ SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 30.954 s [INFO] Finished at: 2015-04-24T11:11:25+08:00 [INFO] Final Memory: 11M/219M [INFO] ------------------------------------------------------------------------
3、进入cosmos-template\target\generated-sources,将生成的脚手架install到本地(也可以deploy到nuexus上,需要在cosmos-template的pom文件里配置好nexus)
mvn install
结果:
dell@DELL-PC /D/angular/cosmos-template (master) $ cd target/generated-sources/archetype dell@DELL-PC /D/angular/cosmos-template/target/generated-sources/archetype (mast er) $ mvn install [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethrea ded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building cosmos-archetype 1.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ cosmos-arc hetype --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e . build is platform dependent! [INFO] Copying 749 resources [INFO] [INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @ co smos-archetype --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e . build is platform dependent! [INFO] Copying 2 resources [INFO] [INFO] --- maven-archetype-plugin:2.3:jar (default-jar) @ cosmos-archetype --- [INFO] Building archetype jar: d:\angular\cosmos-template\target\generated-sourc es\archetype\target\cosmos-archetype-1.0.1-SNAPSHOT [INFO] [INFO] --- maven-archetype-plugin:2.3:integration-test (default-integration-test ) @ cosmos-archetype --- [INFO] Processing Archetype IT project: basic [INFO] ------------------------------------------------------------------------- --- [INFO] Using following parameters for creating project from Archetype: cosmos-ar chetype:1.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------- --- [INFO] Parameter: groupId, Value: archetype.it [INFO] Parameter: artifactId, Value: basic [INFO] Parameter: version, Value: 0.1-SNAPSHOT [INFO] Parameter: package, Value: it.pkg [INFO] Parameter: packageInPathFormat, Value: it/pkg [INFO] Parameter: version, Value: 0.1-SNAPSHOT [INFO] Parameter: package, Value: it.pkg [INFO] Parameter: groupId, Value: archetype.it [INFO] Parameter: artifactId, Value: basic [INFO] Parent element not overwritten in d:\angular\cosmos-template\target\gener ated-sources\archetype\target\test-classes\projects\basic\project\basic\basic-ut il\pom.xml [INFO] Parent element not overwritten in d:\angular\cosmos-template\target\gener ated-sources\archetype\target\test-classes\projects\basic\project\basic\basic-ba se\pom.xml [INFO] Parent element not overwritten in d:\angular\cosmos-template\target\gener ated-sources\archetype\target\test-classes\projects\basic\project\basic\basic-da o\pom.xml [INFO] Parent element not overwritten in d:\angular\cosmos-template\target\gener ated-sources\archetype\target\test-classes\projects\basic\project\basic\basic-se rvice\pom.xml [INFO] Parent element not overwritten in d:\angular\cosmos-template\target\gener ated-sources\archetype\target\test-classes\projects\basic\project\basic\basic-au th\pom.xml [INFO] Parent element not overwritten in d:\angular\cosmos-template\target\gener ated-sources\archetype\target\test-classes\projects\basic\project\basic\basic-we b\pom.xml [INFO] project created from Archetype in dir: d:\angular\cosmos-template\target\ generated-sources\archetype\target\test-classes\projects\basic\project\basic [INFO] No post-archetype-generation goals to invoke. [INFO] [INFO] --- maven-install-plugin:2.5.2:install (default-install) @ cosmos-archety pe --- [INFO] Installing d:\angular\cosmos-template\target\generated-sources\archetype\ target\cosmos-archetype-1.0.1-SNAPSHOT.jar to E:\repo\com\fangdd\cosmos\cosmos-a rchetype\1.0.1-SNAPSHOT\cosmos-archetype-1.0.1-SNAPSHOT.jar [INFO] Installing d:\angular\cosmos-template\target\generated-sources\archetype\ pom.xml to E:\repo\com\fangdd\cosmos\cosmos-archetype\1.0.1-SNAPSHOT\cosmos-arch etype-1.0.1-SNAPSHOT.pom [INFO] [INFO] --- maven-archetype-plugin:2.3:update-local-catalog (default-update-local -catalog) @ cosmos-archetype --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.903 s [INFO] Finished at: 2015-04-24T11:17:51+08:00 [INFO] Final Memory: 22M/355M [INFO] ------------------------------------------------------------------------
相关推荐
Maven Archetype脚手架项目源码,共33个文件,全部采用Java语言编写,涉及多种文件类型如XML配置文件、Git忽略文件、JPG图片、Properties配置文件、JSP页面、Markdown文档和Java源代码等。该项目是一个基于Java的...
而Maven的Archetype插件则可以帮助开发者快速创建新项目的模板,尤其对于有多个子模块的大型项目,能够大大提升开发效率。本篇文章将详细介绍如何使用Maven Archetype来创建一个多子模块的模板工程。 一、理解Maven...
当开发者使用 Maven Archetype 创建项目时,Maven 会依据指定的 archetype ID 生成一个新的目录结构,该结构包含了项目的基本文件和目录,如 `pom.xml`(项目对象模型),源代码文件夹(`src/main/java`,`src/test/...
2. **创建项目**:在命令行中,使用`mvn archetype:generate`命令,并指定对应的archetype id,如`maven-archetype-webapp`,然后按照提示输入项目信息,如groupId、artifactId和version。 3. **编译与运行**:生成...
为了解决这些问题,我们可以利用"Maven Archetype Catalog",这是一个包含了多种Maven模板的元数据文件,能够帮助我们快速、稳定地创建新项目。 标题中的"maven_archetype-catalog.zip"就是一个Maven Archetype ...
这些模板包含了项目的基本目录结构、文件和配置,使得开发者能够快速地创建新项目,而无需从零开始搭建框架。常见的Archetypes包括maven-archetype-webapp和maven-archetype-quickstart。 **maven-archetype-webapp...
### 使用Idea14.1.4和Maven创建Java Web项目 #### 一、概述 在本篇文章中,我们将详细介绍如何使用IntelliJ IDEA 14.1.4版本结合Maven来创建一个Java Web项目。这种方法不仅能够提高开发效率,还能确保项目的结构...
Maven Archetype 是 Maven 的强大特性之一,它简化了新项目的初始化过程,提供了标准化的项目结构,并允许开发者根据需求创建和共享自定义的项目模板。了解和熟练使用 Maven Archetype,能有效提升开发效率,让项目...
《Maven项目模板archetype-catalog.xml详解》 在软件开发过程中,为了提高效率和保持代码规范性,...通过理解和使用`archetype-catalog.xml`,开发者可以更好地利用Maven的模板功能,构建更高效、更规范的项目结构。
标签"Maven Web"表示本文的主要内容是关于使用Maven创建Web项目的过程。 部分内容解释 一、建立Maven项目 建立Maven项目是创建基于Maven的Web项目的第一步。首先,选择建立Maven项目,选择File -> New -> Other,...
下面将详细阐述SSM框架的核心组件以及如何利用maven archetype进行项目构建。 1. Spring框架: Spring是Java领域的一个核心框架,它提供了一种依赖注入(Dependency Injection, DI)和面向切面编程(Aspect-...
4. **生成项目**:输入完毕后,Maven会根据archetype创建一个新的项目结构,包括`src/main/java`(源代码)、`src/main/resources`(资源文件)、`src/test/java`(测试代码)和`pom.xml`(项目对象模型,Maven的...
6. 生成项目:Maven会根据所选Archetype创建一个新的项目目录,包含初始的pom.xml和其他必要的文件。 四、自定义Archetype 如果预定义的Archetypes不能满足需求,可以通过以下步骤创建自己的Archetype: 1. 创建...
这个文件是一个Maven Archetype,它提供了创建标准Web应用项目的基本框架,包含了必要的目录结构和基础配置,使得开发者可以快速启动一个新的Web项目。 首先,让我们理解什么是Maven Archetype。Archetype是Maven...
通过以上步骤,即使在Eclipse无法直接创建Maven项目的情况下,也能利用Maven Archetype Quickstart顺利启动新项目。这体现了Maven的强大之处,即通过命令行工具,开发者可以在任何环境下快速构建和管理项目。同时,...
本文将深入探讨如何在Eclipse中利用Maven创建一个Web应用程序项目。 首先,我们需要理解“Eclipse使用Maven无法建web项目”这个问题可能涉及到的几个关键点。在Eclipse中创建Maven Web项目时,可能会遇到诸如Maven...
【标题】"maven配置proxy和archetype"涉及的是在使用Maven构建Java项目时,如何设置代理服务器(proxy)和创建项目模板(archetype)的相关知识。在开发环境中,尤其是公司网络通常需要通过代理服务器访问外部资源,...
使用Maven Archetype插件可以快速创建一个多模块项目模板。首先,创建一个父项目,然后在父项目的pom.xml中添加子模块的定义,最后在父项目目录下为每个子模块生成对应的目录结构和基本的pom.xml。 4. 依赖管理: ...
首先,当我们尝试使用Maven创建一个新项目时,通常会使用`mvn archetype:generate`命令,这个命令基于一个叫做Archetype的模板来生成项目结构。Archetypes是预定义的项目骨架,它们包含了项目的初始目录结构、基本...
2. 使用archetype:generate命令:通过执行`mvn archetype:generate`命令,开发者可以基于maven-archetype-3.1.2创建新项目,输入相应的ID和属性值,即可自动生成符合规范的新项目结构。 三、依赖管理和插件配置 1....