zoukankan      html  css  js  c++  java
  • ant打包出现问题记录下

    1.build.xml位置:

    2.build.xml脚本为:(有build.xml才能打包)

     1 <?xml version="1.0" encoding="utf-8"?>
     2 <project name="test" basedir="." default="build" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
     3 
     4     <!-- 工程根目录 -->
     5     <property name="project" value="." />
     6 
     7     <!-- 工程名 -->
     8     <property name="project.name" value="cmp-wx-transfer" />
     9 
    10     <!-- 定义时间 -->
    11     <tstamp prefix="mydate">
    12         <format property="builder" pattern="yyyyMMddHHmmss" />
    13     </tstamp>
    14     
    15     <!-- 版本 -->
    16     <property name="version" value="1.0.0" />
    17 
    18     <property name="src" value="${project}/src/main/java" />
    19     <property name="test" value="${project}/src/test/java" />
    20     <property name="deploy" value="${project}/target/${project.name}-${version}-${mydate.builder}" />
    21     <property name="deploy.class" value="${project}/target/class" />
    22     <property name="deploy.lib" value="${deploy}/lib" />
    23 
    24     <!-- 结合maven进行编译、打包、复制依赖的jar -->
    25     <target name="maven-build">
    26 
    27         <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
    28         <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="maven-ant-tasks.classpath" />
    29 
    30         <artifact:pom id="maven.project" file="pom.xml" />
    31         <artifact:dependencies pathId="maven.classpath" filesetid="maven.fileset">
    32             <!--<localrepository path="D:/Java/m2.repository" />-->
    33             <pom refid="maven.project" />
    34         </artifact:dependencies>
    35 
    36         <!-- 编译工程所需的jar -->
    37         <path id="compile.classpath">
    38             <pathelement location="${deploy.class}" />
    39         </path>
    40 
    41         <!-- 编译 -->
    42         <javac srcdir="${src}" target="1.7" destdir="${deploy.class}" classpathref="maven.classpath">
    43             <classpath refid="compile.classpath" />
    44             <compilerarg line="-encoding UTF-8" />
    45         </javac>
    46 
    47         <jar jarfile="${deploy.lib}/${project.name}-${version}-${mydate.builder}.jar" basedir="${deploy.class}">
    48             <include name="com/geor/**" />
    49             <manifest>
    50                 <section name="common">
    51                     <attribute name="Specification-Title" value="${project.name}" />
    52                     <attribute name="Specification-Version" value="${version}" />
    53                     <attribute name="Specification-Vendor" value="georsoft" />
    54                 </section>
    55             </manifest>
    56         </jar>
    57 
    58 
    59         <!-- 复制依赖的jar -->
    60         <copy todir="${deploy.lib}">
    61             <fileset refid="maven.fileset" />
    62             <mapper type="flatten" />
    63         </copy>
    64 
    65         <!-- 复制第三方jar
    66         <copy todir="${deploy.lib}">
    67             <fileset dir="${project}/lib" />
    68         </copy>
    69          -->
    70 
    71         <!-- 复制配置文件 -->
    72         <copy todir="${deploy}">
    73             <fileset dir="${project}/src/main/resources">
    74                 <include name="config/**/*" />
    75                 <include name="data/**"/>
    76             </fileset>
    77         </copy>
    78 
    79         <!-- 复制启动文件 -->
    80         <copy todir="${deploy}">
    81             <fileset dir="${project}/src/main/resources/bin">
    82                 <include name="**/*" />
    83             </fileset>
    84         </copy>
    85     </target>
    86 
    87     <!-- 清理 -->
    88     <target name="clean">
    89         <delete dir="${deploy.class}" />
    90         <mkdir dir="${deploy.class}" />
    91     </target>
    92 
    93     <!-- 入口 -->
    94     <target name="build">
    95         <antcall target="clean" />
    96         <antcall target="maven-build" />
    97     </target>
    98 
    99 </project>

    Could not load definitions from resource org/apache/maven/artifact/ant/antlib.xml. It could not be found.

    解决方法:

    下载 maven-ant-tasks-2.1.3.jar,放在ant安装目录下的lib下即可!

    地址:https://search.maven.org/artifact/org.apache.maven/maven-ant-tasks/2.1.3/jar

  • 相关阅读:
    Centos7安装go.10.1环境
    centos7安装PHP5
    Linux 无文件攻击memfd_create()具体操作步骤
    centos7 '/mnt/hgfs'下共享文件夹不显示问题
    fiddler连接代理手机无法上网问题解决办法
    centos 镜像软件安装包版本低,手动安装过程
    0 upgraded, 0 newly installed, 0 to remove and 112 not upgraded解决方法
    JavaScript高级程序设计(第3版)第七章读书笔记
    JavaScript高级程序设计(第3版)第六章读书笔记
    JavaScript高级程序设计(第3版)第五章读书笔记
  • 原文地址:https://www.cnblogs.com/fansirHome/p/13937747.html
Copyright © 2011-2022 走看看