2015-05-11 63 views
0

我想将我的库部署到我自己的远程Maven存储库。我使用NetBeans 8Maven - 无法部署到远程存储库

这里是我的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 

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

+0

转到命令行并尝试:'mvn deploy'? – khmarbaise

+0

我只是从命令行尝试。刚刚通过命令行输出更新了我的问题。你能看一下吗?用户和密码在settings.xml中是正确的,我可以使用这些凭据登录到Web界面。谢谢 – dazito

+0

通过浏览器登录可能没问题,但maven可以正确登录,因为错误输出显示:'from/to central(http://maven.myserver.com/plugins-release):未经授权,ReasonPhrase:未经授权。 ... – khmarbaise

回答

相关问题