maven2 的学习记录
2010-07-26 14:29
363 查看
麦田的笔记。哈哈:http://bencmai.javaeye.com/blog/394408
推荐 http://www.juvenxu.com/
的博客
中文版手册下载
建立一个maven2管理的flex项目
mvn
archetype:generate
-DarchetypeRepository=http://repository.sonatype.org/content/groups/public
-DarchetypeGroupId=org.sonatype.flexmojos
-DarchetypeArtifactId=flexmojos-archetypes-application
-DarchetypeVersion=3.3.0
这里简单解释一下这个mvn命令:
archetype:generate
是maven的一个标准的生命周期中的一个,他的作用是创建一个新的项目。
-DarchetypeRepository=http://repository.sonatype.org/content/groups/public
由于flex-mojos并不位于maven的默认公共仓库:http://repo1.maven.org/maven2/
, 因此这个参数是为了告诉maven去哪个公共仓库寻找flex-mojos的库。
-DarchetypeGroupId=org.sonatype.flexmojos [b]-DarchetypeArtifactId=flexmojos-archetypes-application
-DarchetypeVersion=3.3.0
[/b]
这三个参数我们放在一起说:groupid和archetypesid 以及 version 组合起来,构成maven系统中用来标识一个项目的绝对定位坐标。
groupid(组名)就是我们一般情况下认为你的项目属于哪个分组,一般以公司域名来命名,比如
com.riameeting.flexmaven 这样子的group
id表示这个项目是在riameeting下flexmaven组中的一个项目。这里,我们看到这个值是
org.sonatype.flexmojos 这个值实际上意味着我们要使用的这个插件(flex-mojos)是在org.sonatype下
flexmojos项目组的开发的众多插件中的一个。
archetypeid(构件名)
实际上是这个项目自身的一个名字,这里其具体值是:flexmojos-archetypes-application 这个项目的名字其实告诉我们,他
是flexmojos中用来创建 flex应用程序项目的插件。后面我们会看到,当你想创建flex的lib项目时,你使用的将会是另外一个
archetypeid
version(版本号) 是显而易见的一个值,指明目前这个插件项目的版本。
建立一个maven2管理的web项目
mvn archetype:create -DgroupId=com.roamer.testwebapp -DartifactId=roamer-test-webapp -DarchetypeArtifactId=maven-archetype-webapp
在maven中指定源码目录和生成的目录
对于已有的wtp项目,其项目布局是不符合maven方式的(eclipse下wtp项目web目录在项目根目录下WebContent,maven布局是在src/main/webapp),这就不能直接通过eclipse:eclipse来生成eclipse的依赖
但可以通过改写项目pom文件来指定源码目录和测试源码目录:
对于web根目录,还不知道怎么指定。
指定maven编译使用的jkd版本
(指定1.6版本)
使用 在远程Repository中不存在的jar文件,放到本地的Repository中去
原理是:把本地的jar文件通过mvn install:install-file命令保存到本地的Repository中,以便pom.xml中调用。
这样就不需要在pom.xml中去定义repository。因为有些jar文件可能不提供internet上的Repository网站.
查看一个项目的包依赖
mvn dependency:resolve
mvn dependency:tree
推荐 http://www.juvenxu.com/
的博客
中文版手册下载
建立一个maven2管理的flex项目
mvn
archetype:generate
-DarchetypeRepository=http://repository.sonatype.org/content/groups/public
-DarchetypeGroupId=org.sonatype.flexmojos
-DarchetypeArtifactId=flexmojos-archetypes-application
-DarchetypeVersion=3.3.0
这里简单解释一下这个mvn命令:
archetype:generate
是maven的一个标准的生命周期中的一个,他的作用是创建一个新的项目。
-DarchetypeRepository=http://repository.sonatype.org/content/groups/public
由于flex-mojos并不位于maven的默认公共仓库:http://repo1.maven.org/maven2/
, 因此这个参数是为了告诉maven去哪个公共仓库寻找flex-mojos的库。
-DarchetypeGroupId=org.sonatype.flexmojos [b]-DarchetypeArtifactId=flexmojos-archetypes-application
-DarchetypeVersion=3.3.0
[/b]
这三个参数我们放在一起说:groupid和archetypesid 以及 version 组合起来,构成maven系统中用来标识一个项目的绝对定位坐标。
groupid(组名)就是我们一般情况下认为你的项目属于哪个分组,一般以公司域名来命名,比如
com.riameeting.flexmaven 这样子的group
id表示这个项目是在riameeting下flexmaven组中的一个项目。这里,我们看到这个值是
org.sonatype.flexmojos 这个值实际上意味着我们要使用的这个插件(flex-mojos)是在org.sonatype下
flexmojos项目组的开发的众多插件中的一个。
archetypeid(构件名)
实际上是这个项目自身的一个名字,这里其具体值是:flexmojos-archetypes-application 这个项目的名字其实告诉我们,他
是flexmojos中用来创建 flex应用程序项目的插件。后面我们会看到,当你想创建flex的lib项目时,你使用的将会是另外一个
archetypeid
version(版本号) 是显而易见的一个值,指明目前这个插件项目的版本。
建立一个maven2管理的web项目
mvn archetype:create -DgroupId=com.roamer.testwebapp -DartifactId=roamer-test-webapp -DarchetypeArtifactId=maven-archetype-webapp
在maven中指定源码目录和生成的目录
对于已有的wtp项目,其项目布局是不符合maven方式的(eclipse下wtp项目web目录在项目根目录下WebContent,maven布局是在src/main/webapp),这就不能直接通过eclipse:eclipse来生成eclipse的依赖
但可以通过改写项目pom文件来指定源码目录和测试源码目录:
<build> <finalName>my-webapp</finalName> <sourceDirectory>src</sourceDirectory> <testSourceDirectory>test</testSourceDirectory> </build>
对于web根目录,还不知道怎么指定。
指定maven编译使用的jkd版本
(指定1.6版本)
<build> <finalName>zara</finalName> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.1</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </pluginManagement> </build>
使用 在远程Repository中不存在的jar文件,放到本地的Repository中去
原理是:把本地的jar文件通过mvn install:install-file命令保存到本地的Repository中,以便pom.xml中调用。
这样就不需要在pom.xml中去定义repository。因为有些jar文件可能不提供internet上的Repository网站.
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14593 -DartifactId=blazeds-common -Dfile=flex-messaging-common.jar mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14593 -DartifactId=blazeds-core -Dfile=flex-messaging-core.jar mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14593 -DartifactId=blazeds-proxy -Dfile=flex-messaging-proxy.jar mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14593 -DartifactId=blazeds-remoting -Dfile=flex-messaging-remoting.jar mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14593 -DartifactId=blazeds-remoting -Dfile=flex-messaging-opt.jar mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14593 -DartifactId=blazeds-rds-server -Dfile=flex-rds-server.jar
查看一个项目的包依赖
mvn dependency:resolve
mvn dependency:tree
相关文章推荐
- SpringBoot 学习记录(六)- maven 打war 包并部署tomcat
- maven学习记录2.2:spring-mvc.xml配置
- maven学习记录
- maven学习记录2.1:pom.xm配置
- Maven学习(十六)--Maven知识点记录 - profile
- maven 学习记录
- maven学习记录2.maven+mybatis+springmvc+sqlserver2008
- maven学习记录1.maven手工加入自定义sqlserver.jar包
- maven 点滴学习记录(一)
- Maven 学习记录
- Maven学习记录3——创建、编译、打包、运行项目
- Maven学习记录(三)--实战引入Spring支持
- Maven学习记录3——创建、编译、打包、运行项目
- 学习记录1:Maven内置属性及使用
- Maven学习记录(三)--实战引入Spring支持
- 学习Maven记录
- Maven学习记录(四)--多模块开发配置
- Adam学习22之在window下使用idea的maven编译安装记录
- Maven学习记录2——Mac maven、jdk环境变量配置