代码之家  ›  专栏  ›  技术社区  ›  liv2hak

从Artifactory下载文件的Java代码不起作用

  •  0
  • liv2hak  · 技术社区  · 7 年前

    我的项目有以下结构。

    $tree
    .
    ├── [4.0K]  src/
    │   └── [4.0K]  main/
    │       └── [4.0K]  java/
    │           └── [4.0K]  org/
    │               └── [4.0K]  jfrog/
    │                   └── [4.0K]  example/
    │                       └── [6.2K]  ClientExample.java
    ├── [1.3K]  pom.xml
    └── [ 781]  README.md
    

    这是来自

    JFrog artifactory java client maven example

    如果我这样做了 mvn compile 我得到以下输出。

    [INFO] Scanning for projects...
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] Building maven-example 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-example ---
    [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] skip non existing resourceDirectory /home/karthik/Workspace/project-examples/artifactory-client-java-examples/maven-example/src/main/resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ maven-example ---
    [INFO] Changes detected - recompiling the module!
    [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
    [INFO] Compiling 1 source file to /home/karthik/Workspace/project-examples/artifactory-client-java-examples/maven-example/target/classes
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3.592 s
    [INFO] Finished at: 2018-09-13T12:03:07+12:00
    [INFO] Final Memory: 18M/135M
    [INFO] ------------------------------------------------------------------------
    

    mvn package

    INFO] Scanning for projects...
    [INFO] 
    [INFO] ------------------------------------------------------------------------
    [INFO] Building maven-example 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-example ---
    [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] skip non existing resourceDirectory /home/karthik/Workspace/project-examples/artifactory-client-java-examples/maven-example/src/main/resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ maven-example ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven-example ---
    [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] skip non existing resourceDirectory /home/karthik/Workspace/project-examples/artifactory-client-java-examples/maven-example/src/test/resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ maven-example ---
    [INFO] No sources to compile
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven-example ---
    [INFO] No tests to run.
    [INFO] 
    [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ maven-example ---
    [INFO] Building jar: /home/karthik/Workspace/project-examples/artifactory-client-java-examples/maven-example/target/maven-example-1.0-SNAPSHOT.jar
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3.751 s
    [INFO] Finished at: 2018-09-13T12:04:30+12:00
    [INFO] Final Memory: 12M/135M
    [INFO] ------------------------------------------------------------------------
    

    如果我尝试运行生成的jar文件。

    java -jar target/maven-example-1.0-SNAPSHOT.jar

    no main manifest attribute, in target/maven-example-1.0-SNAPSHOT.jar

    因为这是从 JFrog github repository 我希望它能起作用。我做错什么了?

    jar file gets generated inside target folder )

    但是,当我按run时,我会被引导到下一页。 IntelliJ - Run/Debug Configurations

    1 回复  |  直到 7 年前
        1
  •  1
  •   Erwin Bolwidt    7 年前

    这个 pom.xml

    运行它的最简单方法是将项目导入到支持maven项目的IDE(Eclipse、IntelliJ等)中,然后从那里运行主类。