2017-09-21 261 views
2

我在部署時遇到了問題,這裏是我得到的錯誤消息。我檢查我的項目目標文件夾尚未創建。mvn部署失敗

[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ LoanCalculator --- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 10.010 s 
[INFO] Finished at: 2017-09-21T16:10:39+05:30 
[INFO] Final Memory: 27M/283M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project LoanCalculator: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 

過程與退出代碼完成1

我檢查互聯網上,沒能找到這個問題的解決方案。我認爲它與pom.xml有關。這裏是pom.xml的相關部分:

 <properties> 
      <spring.version>4.3.5.RELEASE</spring.version> 
      <maven.compiler.source>1.8</maven.compiler.source> 
      <maven.compiler.target>1.8</maven.compiler.target> 
     </properties> 


     <dependencies> 
      <dependency> 
      <groupId>org.jfxtras</groupId> 
      <artifactId>jfxtras-agenda</artifactId> 
      <version>8.0-r1</version> 
     </dependency> 

      <dependency> 
      <groupId>org.wildfly.swarm</groupId> 
      <artifactId>javafx</artifactId> 
      <version>2016.10.0</version> 
     </dependency> 

      <dependency> 
      <groupId>com.oracle</groupId> 
      <artifactId>javafx</artifactId> 
      <version>2.2.3</version> 
      <scope>system</scope> 
      <systemPath>${project.basedir}/lib/jfxrt.jar</systemPath> 
     </dependency> 

      <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-core</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</artifactId> 
      <version>${spring.version}</version> 
     </dependency> 
     <!-- Spring AOP dependency --> 
      <dependency> 
        <groupId>cglib</groupId> 
      <artifactId>cglib</artifactId> 
      <version>2.2</version> 
     </dependency> 

我無法找到正確的依賴關係。

+3

的可能的複製[Maven的:在內部distributionManagement的POM沒有指定的存儲庫元件](https://stackoverflow.com/questions/5910037/maven-repository-element-was-not-specified-in -pom-inside-distributionmanage) – jfs

+0

用這個https://stackoverflow.com/a/13314394/1746118作爲答案。 – nullpointer

+0

其實我沒有在我的項目中的目標文件夾,因爲它不會執行一次。 – Garima

回答

1

如果未創建目標文件夾,可以先嚐試執行「mvn clean install」,看看構建是否正常運行,並且是否使用所需的工件創建了「目標」文件夾。

一旦您確認可行,請在您的pom.xml中添加一個distributionManagement標記,例如下面的代碼,將下面的測試和url替換爲您想要的repo manager configs/values,然後執行「mvn deploy」。

<distributionManagement> 
    <repository> 
      <id>test</id> 
      <url>Repo path</url> 
    </repository> 
</distributionManagement>