Maven - 无法部署到远程存储库

时间:2015-05-11 16:36:54

标签: maven netbeans 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

显然它正在尝试从我的远程服务器下载一些插件。我不是那个服务器的管理员所以我无法访问它,我只是在那里有一个帐户。

1 个答案:

答案 0 :(得分:0)

正如khmarbaise所指出的那样,服务器配置错误。