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 指出的那样,这是服务器配置错误。