首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Maven 疑义

2012-10-24 
Maven 疑问今天刚试了一下 maven整个环境搭好后然后我就将一个web项目 用maven 编译 发布后 生成了war 包

Maven 疑问
   今天刚试了一下 maven 

   整个环境搭好后  然后我就将一个web项目 用maven 编译 发布后 生成了war 包

  但是我发现war 包中 没有class文件 也没lib  只有空空的目录 。。

   这是为什么呀。??????????????

  今天清楚了 自己配置有问题呀

  遇见两种错误:1 找不到符号
                2 找不到软件包

  解决:pom.xml 中的依赖没配置好  也就是说你的库中没有你项目要的jar


  step and step...

  <modelVersion>4.0.0</modelVersion>
  <groupId>MySys</groupId>
  <artifactId>MySys</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>MySys</name>
  <description>业余,</description>
 
  <properties>
  <!-- commons jar -->
  <commons.lang.version>2.6</commons.lang.version>
  <commons.beanutils.version>1.8.0</commons.beanutils.version>
        <commons.codec.version>1.4</commons.codec.version>
        <commons.collections.version>3.2.1</commons.collections.version>
        <commons.dbcp.version>1.4</commons.dbcp.version>
        <commons.email.version>20030310.165926</commons.email.version>
        <commons.fileupload.version>1.2.2</commons.fileupload.version>
        <commons.httpclient.version>3.0.1</commons.httpclient.version>
        <commons.io.version>2.0.1</commons.io.version>
        <commons.logging.version>1.1.1</commons.logging.version>
        <commons.pool.version>1.5.4</commons.pool.version>
       
        <!-- jta -->
        <jta.version>1.1</jta.version>
       
        <!-- jdbc -->
        <mysql.driver.version>5.1.18</mysql.driver.version>
        <oralce.driver.version>10.2.0.2.0</oralce.driver.version>
       
        <!-- log4j -->
        <log4j.version>1.2.16</log4j.version>
        <org.slf4j.version>1.6.4</org.slf4j.version>
       
        <!-- jetty -->
       
        <!-- servlet -->
        <javax.servlet.version>2.5</javax.servlet.version>
        <jstl.version>1.1.2</jstl.version>
      
        <!-- activiti -->
        <activation.version>1.1</activation.version>
        <activiti.version>5.8</activiti.version>
       
        <!-- json -->
        <jackson.version>1.9.2</jackson.version>
        <json.lib.version>2.4</json.lib.version>
        <ezmorph.version>1.0.6</ezmorph.version>
        <fastJson.version>1.1.15</fastJson.version>
       
        <!-- mybatis -->
        <mybatis.version>3.0.6</mybatis.version>
        <mybatis.spring.version>1.0.2</mybatis.spring.version>
        <mybatis.generator.core.version>1.3.1</mybatis.generator.core.version>
        <!--maven mybatis生成文件-->
        <mybatis.generator.configurationFile>generatorConfig.xml</mybatis.generator.configurationFile>
       
        <!-- spirng -->
        <spring.version>3.0.6.RELEASE</spring.version>
       
        <!-- hibernate  -->
<hibernate.version>3.6.0.Final</hibernate.version>
<hibernate.jpa.version>1.0.0.Final</hibernate.jpa.version>
<hibernate.annotations.version>3.4.0.GA</hibernate.annotations.version>
<hibernate.validator.version>4.1.0.Final</hibernate.validator.version>
<javassist.version>3.14.0-GA</javassist.version>

<!-- other -->
        <ant.version>1.6.5</ant.version>
        <cglib.version>2.2</cglib.version>
        <cglib.nodep.version>2.2</cglib.nodep.version>
        <c3p0.version>0.9.0.4</c3p0.version>
        <dom4j.version>1.6.1</dom4j.version>
        <junit.version>4.8.1</junit.version>
        <jdom.version>1.0</jdom.version>
        <antlr.version>2.7.7</antlr.version>
        <aopalliance.version>1.0</aopalliance.version>
        <aspectjrt.version>1.6.12</aspectjrt.version>
        <aspectjweaver.version>1.6.12</aspectjweaver.version>
        <mail.version>1.4.4</mail.version>
       
        <!-- cxf -->
<cxf.version>2.2.10</cxf.version>
        <!-- freemarker -->
        <freemarker.version>2.3.18</freemarker.version>
       
        <!-- poi -->
        <poi.version>3.8-beta4</poi.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
 
  <build>
     <sourceDirectory>src</sourceDirectory>
     <outputDirectory>WebContent/WEB-INF/classes</outputDirectory><!--编译后的java文件输出的文件夹位置。  -->
  <resources><!-- 存放资源文件。这里的文件不需要编译,在部署打包时,直接复制这里的文件 --> 
<resource> 
<directory>etc</directory>
<excludes> 
<exclude>**/*.java</exclude>
</excludes>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource> 
</resources>

  <plugins>
    <!-- 资源插件 -->
  <plugin>
      <artifactId>maven-resources-plugin</artifactId>
      <configuration>
      <encoding>UTF-8</encoding>
      </configuration>
      </plugin>
      <!-- 默认编译 -->
    <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
      <configuration>
      <encoding>UTF-8</encoding>
      <source>1.6</source>
      <target>1.6</target>
      </configuration>
      </plugin>
    <!-- 打包war插件 -->
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
  </plugin>
  <!-- jar管理 -->
  <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                        </manifest>
                    </archive>
                </configuration>
           </plugin>
           <plugin>
           <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.1</version>
    <executions>
     <execution>
      <id>copy</id>
      <phase>install</phase>
      <goals>
       <goal>copy-dependencies</goal>
      </goals>
      <configuration>
       <outputDirectory>
        ${project.build.directory}/lib
       </outputDirectory>
      </configuration>
     </execution>
    </executions>
   </plugin>
   <!-- jetty 发布  mvn jetty:run
   <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>8.1.0.v20120127</version>
            <configuration>
                <webAppConfig>
                    <contextPath>/sys</contextPath>
                </webAppConfig>
                <webAppSourceDirectory>WebContent</webAppSourceDirectory>
            </configuration>
           </plugin>-->
           <!-- tomcat 发布 mvn tomcat:run-->
           <plugin>
           <groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat-maven-plugin</artifactId>
                <version>1.1</version>
                <configuration>
                     <path>/sys</path>
                     <warSourceDirectory>WebContent</warSourceDirectory>
                </configuration>
           </plugin>
           <!-- maven mybatis生成文件 -->
           <plugin> 
    <groupId>org.mybatis.generator</groupId> 
    <artifactId>mybatis-generator-maven-plugin</artifactId> 
    <version>1.3.1</version> 
   </plugin> 
  </plugins>
  </build>
  <dependencies>
     <!--mysql  jar -->
  <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.driver.version}</version>
</dependency>
<dependency>
    <groupId>jdbc</groupId>
    <artifactId>oracle</artifactId>
    <version>${oralce.driver.version}</version>
</dependency>

<!-- commons -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>${commons.lang.version}</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons.beanutils.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons.codec.version}</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>${commons.collections.version}</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${commons.dbcp.version}</version>
</dependency>
<dependency>
<groupId>commons-email</groupId>
<artifactId>commons-email</artifactId>
<version>${commons.email.version}</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons.fileupload.version}</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>${commons.httpclient.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>${commons.lang.version}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${commons.logging.version}</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>${commons.pool.version}</version>
</dependency>

<!-- log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j.version}</version>
<scope>runtime</scope>
</dependency>

<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${javax.servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency> 
            <groupId>javax.servlet</groupId> 
            <artifactId>jstl</artifactId> 
            <version>${jstl.version}</version> 
        </dependency>

<!-- activiti -->
<dependency>
<groupId>activiti</groupId>
<artifactId>activation</artifactId>
<version>${activation.version}</version>
</dependency>
<dependency>
<groupId>activiti</groupId>
<artifactId>activiti-cxf</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>activiti</groupId>
<artifactId>activiti-cxf-sources</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>activiti</groupId>
<artifactId>activiti-engine-sources</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>activiti</groupId>
<artifactId>activiti-spring</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>activiti</groupId>
<artifactId>activiti-spring-sources</artifactId>
<version>${activiti.version}</version>
</dependency>

<!-- 其它 的jar -->
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>${ant.version}</version>
</dependency>
<dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib-nodep</artifactId>
        <version>${cglib.nodep.version}</version>
     </dependency>
     <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>${cglib.version}</version>
     </dependency>
     <dependency>
    <groupId>c3p0</groupId>
    <artifactId>c3p0</artifactId>
    <version>${c3p0.version}</version>
</dependency>
<dependency>
    <groupId>dom4j</groupId>
    <artifactId>dom4j</artifactId>
    <version>${dom4j.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
    <groupId>javax.transaction</groupId>
    <artifactId>jta</artifactId>
    <version>${jta.version}</version>
</dependency>

<!-- json lib
<dependency>
    <groupId>net.sf.ezmorph</groupId>
    <artifactId>ezmorph</artifactId>
    <version>${ezmorph.version}</version>
</dependency>
<dependency>
    <groupId>net.sf.json-lib</groupId>
    <artifactId>json-lib</artifactId>
    <version>${json.lib.version}</version>
</dependency>-->

<!-- fastJson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastJson.version}</version>
</dependency>

<!-- spring json -->
<dependency>
    <groupId>org.codehaus.jackson</groupId>
    <artifactId>jackson-core-asl</artifactId>
    <version>${jackson.version}</version>
</dependency>
<dependency>
    <groupId>org.codehaus.jackson</groupId>
    <artifactId>jackson-mapper-asl</artifactId>
    <version>${jackson.version}</version>
</dependency>

<!-- mybatis
<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis</artifactId>
    <version>${mybatis.version}</version>
</dependency>
<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis-spring</artifactId>
    <version>${mybatis.spring.version}</version>
</dependency>
<dependency>
    <groupId>org.mybatis.generator</groupId>
    <artifactId>mybatis-generator-core</artifactId>
    <version>${mybatis.generator.core.version}</version>
</dependency>
<dependency>
    <groupId>org.mybatis.generator</groupId>
    <artifactId>mybatis-generator-maven-plugin</artifactId>
    <version>${mybatis.generator.core.version}</version>
</dependency>
-->

<!-- spring -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aop</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-asm</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aspects</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context-support</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-expression</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-instrument</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-instrument-tomcat</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jms</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-orm</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-test</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc-portlet</artifactId>
    <version>${spring.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>${spring.version}</version>
</dependency>

<!-- hibernate -->
<dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-core</artifactId>
           <version>${hibernate.version}</version>
     </dependency>
     <!-- <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>${hibernate.annotations.version}</version>
</dependency> -->
     <dependency>
           <groupId>org.hibernate.javax.persistence</groupId>
           <artifactId>hibernate-jpa-2.0-api</artifactId>
           <version>1.0.0.Final</version>
     </dependency>
     <dependency> 
            <groupId>org.hibernate</groupId> 
            <artifactId>hibernate-ehcache</artifactId> 
            <version>${hibernate.version}</version> 
     </dependency>
     <dependency>
    <groupId>org.javassist</groupId>
    <artifactId>javassist</artifactId>
    <version>${javassist.version}</version>
</dependency>
     <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-validator</artifactId>
           <version>${hibernate.validator.version}</version>
           <exclusions>
               <exclusion>
                   <groupId>javax.xml.bind</groupId>
                   <artifactId>jaxb-api</artifactId>
               </exclusion>
               <exclusion>
                   <groupId>com.sun.xml.bind</groupId>
                   <artifactId>jaxb-impl</artifactId>
               </exclusion>
           </exclusions>
     </dependency>

<!-- cxf
<dependency> 
         <groupId>org.apache.cxf</groupId> 
         <artifactId>cxf-rt-core</artifactId> 
         <version>${cxf.version}</version> 
     </dependency> 
     <dependency> 
         <groupId>org.apache.cxf</groupId> 
         <artifactId>cxf-rt-frontend-jaxws</artifactId> 
         <version>${cxf.version}</version> 
     </dependency> 
     <dependency> 
         <groupId>org.apache.cxf</groupId> 
         <artifactId>cxf-rt-transports-http</artifactId> 
         <version>${cxf.version}</version> 
     </dependency>  -->
    
<!-- 其它 -->
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>${jdom.version}</version>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>${antlr.version}</version>
</dependency>
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>${aopalliance.version}</version>
</dependency>
<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjrt</artifactId>
    <version>${aspectjrt.version}</version>
</dependency>
<dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjweaver</artifactId>
    <version>${aspectjweaver.version}</version>
</dependency>
<dependency>
    <groupId>javax.mail</groupId>
    <artifactId>mail</artifactId>
    <version>${mail.version}</version>
</dependency>

<!-- freemarker-->
<dependency>
    <groupId>org.freemarker</groupId>
    <artifactId>freemarker</artifactId>
    <version>${freemarker.version}</version>
</dependency>

<!-- poi -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>${poi.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml-schemas</artifactId>
    <version>${poi.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-excelant</artifactId>
    <version>${poi.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-scratchpad</artifactId>
    <version>${poi.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>${poi.version}</version>
</dependency>

<!-- report -->

  </dependencies>
</project>

热点排行