听说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

解决方案 »

  1.   

    maven是一个下载工具,也管理项目,但是更多的是来下载的,方便远程下载的
      

  2.   


    说的是,但似乎不全面哑,Maven还有其他很多功能,比如多项目管理
      

  3.   

    我现在用的就是maven管理多个工程。。
    呵呵 只知道皮毛。。
      

  4.   


    能否自己尝试下把demo抽取出来?就当是自己的一次学习呀~~~:)
      

  5.   

    欢迎各位java大侠、小虾加入QQ高级群:45271133  群满500人为止,热烈邀请大侠们加入指点~!
      

  6.   

    common <- base <- businesscommon是base子工程,base是business子工程
    每个子工程向上引用parent,这样?
      

  7.   

    对头,是这样的哦~~~看来你有希望能提供demo,在线等~~~^_^
      

  8.   

    common的<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
      

  9.   

    我在网上也查了些资料,也尝试建了些项目,但是run->build,package,...等命令执行时会出错 :(
      

  10.   

    报什么错?执行命令是mvn -Dmaven.test.skip=true clean install
      

  11.   

    [INFO] Scanning for projects...
    [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] ------------------------------------------------------------------------
      

  12.   

    你用
    mvn clean install
    或者
    mvn clean package看什么错
      

  13.   

    看看maven呗,不要盲人摸象了maven,你可以先简单看成是一个ant,算是编译,部署工具。但是maven更倾向于用pom文件来管理项目。
    你也可以写pom的插件,来完成更多的功能。而且maven可以很好的支持OSGi,JUnit,Eclipse等其他的工具或者产品。
      

  14.   


    我的eclips装了m2clipse插件,执行Run->package之后,在cmd控制台执行mvn -e看的错误
      

  15.   

    没用过插件cmd手动输入mvn clean package看下
      

  16.   


    网上看了些资料,也自己尝试了些demo,可就是问题不断 -_-~~!
      

  17.   


    cmd进入到项目目录之后,mvn clean package,一样的错呀
      

  18.   

    贴你的pom.xml吧这玩意儿很麻烦的你的business的pom有没有 <build>
    <plugins>
    <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
    <source>1.5</source>
    <target>1.5</target>
    </configuration>
    </plugin>
    </plugins>
    </build>
      

  19.   

    to windforcecn:能留个邮箱没?
    干脆我把工程法给你,你帮看看?
      

  20.   

    有没有小结什么的,能分享下吗?邮箱:[email protected]