zoukankan      html  css  js  c++  java
  • 可添加功能-----机器学习管理平台

    1.可以添加Junit,用于程序单元测试

    <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.11</version>
          <scope>test</scope>
        </dependency>
      </dependencies>

    2.可以添加log4j,用于添加程序运行日志信息

    Let's add another dependency to our project. Let's say we've added some logging to the code and need to add log4j as a dependency. First, we need to know what the groupId, artifactId, and version are for log4j. We can browse ibiblio and look for it, or use Google to help by searching for "site:www.ibiblio.org maven2 log4j". The search shows a directory called /maven2/log4j/log4j (or /pub/packages/maven2/log4j/log4j). In that directory is a file called maven-metadata.xml. Here's what the maven-metadata.xml for log4j looks like:

    <metadata>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.1.3</version>
      <versioning>
        <versions>
          <version>1.1.3</version>
          <version>1.2.4</version>
          <version>1.2.5</version>
          <version>1.2.6</version>
          <version>1.2.7</version>
          <version>1.2.8</version>
          <version>1.2.11</version>
          <version>1.2.9</version>
          <version>1.2.12</version>
        </versions>
      </versioning>
    </metadata>

    From this file, we can see that the groupId we want is "log4j" and the artifactId is "log4j". We see lots of different version values to choose from; for now, we'll just use the latest version, 1.2.12 (some maven-metadata.xml files may also specify which version is the current release version). Alongside the maven-metadata.xml file, we can see a directory corresponding to each version of the log4j library. Inside each of these, we'll find the actual jar file (e.g. log4j-1.2.12.jar) as well as a pom file (this is the pom.xml for the dependency, indicating any further dependencies it might have and other information) and another maven-metadata.xml file. There's also an md5 file corresponding to each of these, which contains an MD5 hash for these files. You can use this to authenticate the library or to figure out which version of a particular library you may be using already.

    Now that we know the information we need, we can add the dependency to our pom.xml:

    <project xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                          http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
     
      <groupId>com.mycompany.app</groupId>
      <artifactId>my-app</artifactId>
      <version>1.0-SNAPSHOT</version>
      <packaging>jar</packaging>
     
      <name>Maven Quick Start Archetype</name>
      <url>http://maven.apache.org</url>
     
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.11</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
          <version>1.2.12</version>
          <scope>compile</scope>
        </dependency>
      </dependencies>
    </project>

    Now, when we compile the project (mvn compile), we'll see Maven download the log4j dependency for us.

    学习的过程中总会得到一些心得体会,认真地将它们记录下来并分享给每一个愿意花费时间去阅读它们的人,然后意外地收获某个读者的评论,从而激发出新的感想,是一件十分令人欢快的事。如果你也在研习这方面的知识,欢迎加入到我们的队伍中来,和我们一起进步吧(^_^)
  • 相关阅读:
    git 在局域网新建远程库及本地开发常用命令
    sql server 常用操作
    LNMPA遇到504 Gateway time-out错误的解决方法
    安全cookie登录状态设计方案
    linux 启动ftp服务,sftp服务
    最详细的cookie和浏览隐私之间的关系
    IE无法获得cookie,ie不支持cookie的解决办法,火狐支持
    关于mysql联合索引
    常用Mysql命令
    常用Linux命令、包括vi 、svn
  • 原文地址:https://www.cnblogs.com/lxrm/p/6192846.html
Copyright © 2011-2022 走看看