2016-01-10 44 views
0

Target Folder但我已經切換到Maven用它很漂亮新。我已經在pom.xml中將包裝設置爲JAR。但我的問題是,一旦構建通過,我可以在哪裏找到這個jar文件(位置)。我在哪裏可以在pom.xml中設置位置,並且我必須在pom中添加任何jar插件。 CMD outputMaven的:找不到我用ANT之前的jar文件

<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>tiger</groupId> 
    <artifactId>SampleProject</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>SampleProject</name> 
    <url>http://maven.apache.org</url> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.seleniumhq.selenium</groupId> 
      <artifactId>selenium-java</artifactId> 
      <version>2.45.0</version> 
     </dependency> 

     <dependency> 
      <groupId>org.apache.poi</groupId> 
      <artifactId>poi</artifactId> 
      <version>3.13</version> 
     </dependency> 

     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.17</version> 
     </dependency> 

     <dependency> 
      <groupId>org.testng</groupId> 
      <artifactId>testng</artifactId> 
      <version>6.9.6</version> 
     </dependency> 

     <!-- //for reportng(guice ,velocity is added) --> 
     <dependency> 
      <groupId>org.uncommons</groupId> 
      <artifactId>reportng</artifactId> 
      <version>1.1.4</version> 
     </dependency> 

     <dependency> 
      <groupId>com.google.inject</groupId> 
      <artifactId>guice</artifactId> 
      <version>3.0</version> 
     </dependency> 

     <dependency> 
      <groupId>velocity</groupId> 
      <artifactId>velocity-dep</artifactId> 
      <version>1.4</version> 
     </dependency> 

    </dependencies> 

    <build> 
     <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-surefire-plugin</artifactId> 
        <version>2.18.1</version> 

        <configuration> 
         <suiteXmlFiles> 
          <suiteXmlFile>testng.xml</suiteXmlFile> 
         </suiteXmlFiles> 
        </configuration> 

       </plugin> 
      </plugins> 
     </pluginManagement> 
    </build> 
    <!-- <reporting> <plugins> TestNG-xslt related configuration. <plugin> <groupId>org.reportyng</groupId> 
     <artifactId>reporty-ng</artifactId> <version>1.2</version> <configuration> 
     Output directory for the testng xslt report <outputDir>/target/testng-xslt-report</outputDir> 
     <sortTestCaseLinks>true</sortTestCaseLinks> <testDetailsFilter>FAIL,SKIP,PASS,CONF,BY_CLASS</testDetailsFilter> 
     <showRuntimeTotals>true</showRuntimeTotals> </configuration> </plugin> </plugins> 
     </reporting> --> 


</project> 
+0

罐子將是你的項目的'target'文件夾內。 – Tunaki

+0

很抱歉,但它是不是有 –

+0

你能發表您的POM呢?另外,你是怎麼跑Maven的?命令是什麼? – Tunaki

回答

0

這個插件有助於創建罐子,我以前用過。

 <!-- Make this jar executable --> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-jar-plugin</artifactId> 
      <configuration> 
       <!-- DO NOT include log4j.properties file in your Jar --> 
       <excludes> 
       <exclude>**/log4j.properties</exclude> 
       </excludes> 
       <archive> 
       <manifest> 
        <!-- Jar file entry point --> 
        <mainClass>com.project.app</mainClass> 
       </manifest> 
       </archive> 
      </configuration> 
     </plugin> 

進一步請到拋出下面的鏈接做進一步的瞭解 https://maven.apache.org/shared/maven-archiver/examples/classpath.html#Make

How can I create an executable JAR with dependencies using Maven?

謝謝

+0

這個插件在pom中是強制性的以生成jar嗎 –

+0

是的,請參閱maven文檔鏈接提供更多解釋 –

0

的問題是基於消息The POM for testng...is not valid,這意味着無論你選擇了一個錯誤的版本(除了給定的版本很舊),或者你沒有訪問Maven中心來下載你的依賴關係,或者你有一個在有代理/防火牆......除此之外,你已經開始,其開始基於硒Chrome瀏覽器,這可能需要一段時間,在已經開始的瀏覽器或可能基於其他的問題都堅持測試...

+0

那麼我已經更新了所有的jar,但它沒有解決問題 –

1

玉傢伙我想問題是Chrome瀏覽器,我試着用Firefox運行相同的測試,它運行良好,得到了BUILD SUCCESS消息和jar以及目標文件夾下。無論如何感謝您的幫助。

相關問題