簡體   English   中英

Maven-無法部署到遠程存儲庫

[英]Maven - Can't deploy to remote repository

我正在嘗試將庫部署到我自己的遠程Maven存儲庫中。 我正在使用NetBeans 8

這是我的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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.my.company.library.name</groupId>
    <artifactId>LibraryId</artifactId>
    <version>3.0</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
    </properties>
    <dependencies>
        (... my dependencies...)
    </dependencies>

    <distributionManagement>
        <repository>
            <id>myServer</id>
            <name>myServer Repository</name>
            <url>http://maven.mycompany.com</url>
        </repository>
    </distributionManagement>
</project>

這是我的settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <servers>
    <server>
      <username>dwnz</username>
      <id>central</id>
    </server>
    <server>
      <id>myServer</id>
      <username>dwnz</username>
      <password>mySuperSecretPassword</password>
    </server>
  </servers>
  <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>libs-release</name>
          <url>http://maven.mycompany.com/libs-release</url>
        </repository>
        <repository>
          <snapshots />
          <id>snapshots</id>
          <name>libs-snapshot</name>
          <url>http://maven.mycompany.com/libs-snapshot</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>central</id>
          <name>plugins-release</name>
          <url>http://maven.mycompany.com/plugins-release</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>snapshots</id>
          <name>plugins-snapshot</name>
          <url>http://maven.mycompany.com/plugins-snapshot</url>
        </pluginRepository>
      </pluginRepositories>
      <id>artifactory</id>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>artifactory</activeProfile>
  </activeProfiles>
</settings>

當我進行Clean and Build在NetBeans上得到以下輸出:

cd /Users/dwnz/Development/Server/code/project/myLibrary; JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home "/Applications/NetBeans/NetBeans 8.0.2.app/Contents/Resources/NetBeans/java/maven/bin/mvn" clean install
Scanning for projects...

------------------------------------------------------------------------
Building library 3.0
------------------------------------------------------------------------

--- maven-clean-plugin:2.4.1:clean (default-clean) @ library ---
Deleting /Users/dwnz/Development/Server/code/project/myLibrary/target

--- maven-resources-plugin:2.5:resources (default-resources) @ myLibrary ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 0 resource

--- maven-compiler-plugin:2.3.2:compile (default-compile) @ myLibrary ---
Compiling 183 source files to /Users/dwnz/Development/Server/code/project/myLibrary/target/classes

--- maven-resources-plugin:2.5:testResources (default-testResources) @ myLibrary ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory /Users/dwnz/Development/Server/code/project/myLibrary/src/test/resources

--- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ myLibrary ---
No sources to compile

--- maven-surefire-plugin:2.10:test (default-test) @ myLibrary ---
No tests to run.
Surefire report directory: /Users/dwnz/Development/Server/code/project/myLibrary/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0


--- maven-jar-plugin:2.3.2:jar (default-jar) @ myLibrary ---
Building jar: /Users/dwnz/Development/Server/code/project/myLibrary/target/library-3.0.jar

--- maven-install-plugin:2.3.1:install (default-install) @ myLibrary ---
Installing /Users/dwnz/Development/Server/code/project/myLibrary/target/library-3.0.jar to /Users/dwnz/.m2/repository/com/myCompany/project/server/myLibrary/library/3.0/library-3.0.jar
Installing /Users/dwnz/Development/Server/code/project/myLibrary/pom.xml to /Users/dwnz/.m2/repository/com/myCompany/project/server/myLibrary/library/3.0/library-3.0.pom
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 3.426s
Finished at: Mon May 11 17:16:22 WEST 2015
Final Memory: 18M/220M
------------------------------------------------------------------------

在我的服務器上,我正在使用Artifactory。

在我的遠程Maven存儲庫中,未部署我的庫。 任何人都知道或可以發現我在這里做錯了什么,為什么它沒有部署在我的遠程Maven存儲庫中?

------編輯-------

我只是嘗試在命令行上使用mvn deploy仍然沒有成功。 這是命令行中的輸出:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building myLibrary 3.0
[INFO] ------------------------------------------------------------------------
Downloading: http://maven.myserver.com/plugins-release/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
Downloading: http://maven.myserver.com/plugins-snapshot/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.119 s
[INFO] Finished at: 2015-05-11T18:22:35+01:00
[INFO] Final Memory: 8M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (http://maven.myserver.com/plugins-release): Not authorized , ReasonPhrase:Unauthorized. -> [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/PluginResolutionException

顯然,它正在嘗試從我的遠程服務器下載一些插件。 我不是該服務器的管理員,所以我無法訪問它,我在那里只有一個帳戶。

正如khmarbaise指出的,這是服務器配置錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM