听说Maven用例管理多项目很强大,
下载了个Maven2.1.1,配好环境,又下装了一个eclipse插件m2clipse,
但不知道如何创建这样一个大的工程,含有3个工程,分别是:
1.common工程:通用的后台代码,会被其他2个工程引用,没有页面文件,所以要打成jar,另外这个工程的pom.xml定义整个项目需要引用的jar,供base工程和business工程的pom.xml继承;
2.base工程:是个web工程,是基础数据模块,引用了common工程,
3.business工程:主业务工程,需要引用common工程和base工程;不知道我说清楚了没有,不明白还原跟帖~~
能有人帮忙发个demo吗? 发到
顶贴又分,第一个能满足3个需求的得大头~ O(∩_∩)O
下载了个Maven2.1.1,配好环境,又下装了一个eclipse插件m2clipse,
但不知道如何创建这样一个大的工程,含有3个工程,分别是:
1.common工程:通用的后台代码,会被其他2个工程引用,没有页面文件,所以要打成jar,另外这个工程的pom.xml定义整个项目需要引用的jar,供base工程和business工程的pom.xml继承;
2.base工程:是个web工程,是基础数据模块,引用了common工程,
3.business工程:主业务工程,需要引用common工程和base工程;不知道我说清楚了没有,不明白还原跟帖~~
能有人帮忙发个demo吗? 发到
顶贴又分,第一个能满足3个需求的得大头~ O(∩_∩)O
解决方案 »
- TCP的问题
- 静态变量不用考虑线程冲突的问题吗?
- jbuilder用Native 生成exe时遇到的问题,求解.
- 关于树的一个问题 搞不明白了,大家可以COPY过去 跑下
- 生成1000条数据,格式姓名:aa;学号:1,2,3,4....;年龄:22,用java程序实现,请大侠帮帮忙
- 问个简单的问题,关于构造函数的。。。
- 有关JBuilder8的Sample的送分级的问题
- 繁琐不够简洁,为什么不尝试python这样的易学易用的语言
- 人气好像不是很旺呀!放点分,给大家送礼啦~
- 何为tomcat,,等。。java 入门必懂!!回答有分!!!
- 堆和栈在java中怎么存储的
- java数据库连接在一段时间后出现的问题
说的是,但似乎不全面哑,Maven还有其他很多功能,比如多项目管理
呵呵 只知道皮毛。。
能否自己尝试下把demo抽取出来?就当是自己的一次学习呀~~~:)
每个子工程向上引用parent,这样?
<artifactId>base</artifactId>
<groupId>com.xxx</groupId>
<version>1.0_A0</version>
</parent>base的<parent>
<artifactId>business</artifactId>
<groupId>com.xxx</groupId>
<version>1.0_A0</version>
</parent>business的
普通的maven配置
记得这个地方<packaging>pom</packaging>
其它的配置好自己的artifactId,groupId,version,编译主工程时会向下编译的apache网上有demo,自己写写吧http://maven.apache.org/pom.html
[ERROR] You have not specified any goals or lifecycle phases for Maven to execute.Either specify a goal or lifecycle phase on the command line
(you may want to try 'package' to get started), or configure the
<defaultGoal/> element in the build section of your project POM.
NOTE: You can also chain multiple goals/phases together, as in the following example:
mvn clean package
Some tips:
- Maven in 5 Minutes guide (http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html)
- Maven User's documentation (http://maven.apache.org/users/)
- Maven Plugins page (http://maven.apache.org/plugins/)
- CodeHaus Mojos Project page (http://mojo.codehaus.org/plugins.html)[INFO] ------------------------------------------------------------------------
[INFO] For more information, run with the -e flag
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILED
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Oct 13 16:44:44 CST 2009
[INFO] Final Memory: 1M/4M
[INFO] ------------------------------------------------------------------------
cmd控制台,执行mvn -e后:
C:\Documents and Settings\ThinkPad>mvn -e
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO]You must specify at least one goal or lifecycle phase to perform build steps.
The following list illustrates some commonly used build commands: mvn clean
Deletes any build output (e.g. class files or JARs).
mvn test
Runs the unit tests for the project.
mvn install
Copies the project artifacts into your local repository.
mvn deploy
Copies the project artifacts into the remote repository.
mvn site
Creates project documentation (e.g. reports or Javadoc).Please see
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
for a complete description of available lifecycle phases.Use "mvn --help" to show general usage information about Maven's command line.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException:You must specify at least one goal or lifecycle phase to perform build steps.
The following list illustrates some commonly used build commands: mvn clean
Deletes any build output (e.g. class files or JARs).
mvn test
Runs the unit tests for the project.
mvn install
Copies the project artifacts into your local repository.
mvn deploy
Copies the project artifacts into the remote repository.
mvn site
Creates project documentation (e.g. reports or Javadoc).Please see
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
for a complete description of available lifecycle phases.Use "mvn --help" to show general usage information about Maven's command line.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultL
fecycleExecutor.java:172)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:
0)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430 at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Oct 13 16:45:26 CST 2009
[INFO] Final Memory: 1M/4M
[INFO] ------------------------------------------------------------------------
mvn clean install
或者
mvn clean package看什么错
你也可以写pom的插件,来完成更多的功能。而且maven可以很好的支持OSGi,JUnit,Eclipse等其他的工具或者产品。
我的eclips装了m2clipse插件,执行Run->package之后,在cmd控制台执行mvn -e看的错误
网上看了些资料,也自己尝试了些demo,可就是问题不断 -_-~~!
cmd进入到项目目录之后,mvn clean package,一样的错呀
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
干脆我把工程法给你,你帮看看?