2016-02-04 50 views
0

我試圖下載Netty Source Code並運行包含的示例。如何使Netty示例工作

我安裝的jdk版本是1.8.0_65

我試圖將示例(在示例文件夾...\netty-4.1\example)轉換爲eclipse項目與maven(mvn eclipse:eclipse)。

但得到構建錯誤下面說。

[INFO] 
[INFO] >>> maven-eclipse-plugin:2.10:eclipse (default-cli) > generate-resources @ netty-example >>> 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.558 s 
[INFO] Finished at: 2016-02-04T13:40:13+08:00 
[INFO] Final Memory: 11M/28M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal on project netty-example: Could not resolve dependencies for project io.netty:netty-example:jar:4.1.0.CR2-SNAPSHOT: Failure to fi 
nd io.netty:netty-tcnative:jar:windows-x86_32:1.1.33.Fork11 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be r 
eattempted until the update interval of central has elapsed or updates are forced -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project netty-example: Could not resolve dependencies for project io.netty:net 
ty-example:jar:4.1.0.CR2-SNAPSHOT: Failure to find io.netty:netty-tcnative:jar:windows-x86_32:1.1.33.Fork11 in https://repo.maven.apache.org/maven2 was cached i 
n the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced 
     at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221) 
     at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:245) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:352) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:197) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 
     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 
     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 
     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 
     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) 
     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 
     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 
     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) 
     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) 
     at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:497) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project io.netty:netty-example:jar:4.1.0.CR2-SNAPSHOT: Fai 
lure to find io.netty:netty-tcnative:jar:windows-x86_32:1.1.33.Fork11 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution wil 
l not be reattempted until the update interval of central has elapsed or updates are forced 
     at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:211) 
     at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195) 
     ... 27 more 
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Failure to find io.netty:netty-tcnative:jar:windows-x86_32:1.1.33.Fork11 in https://repo 
.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are 
forced 
     at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:384) 
     at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:205) 
     ... 28 more 
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find io.netty:netty-tcnative:jar:windows-x86_32:1.1.33.Fork11 in https://repo.m 
aven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are fo 
rced 
     at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444) 
     at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246) 
     at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:367) 
     ... 29 more 
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find io.netty:netty-tcnative:jar:windows-x86_32:1.1.33.Fork11 in https://repo.maven 
.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced 

     at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:231) 
     at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:206) 
     at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:585) 
     at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:503) 
     at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421) 
     ... 31 more 
[ERROR] 
[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/DependencyResolutionException 

而且我遵循了消息中提到的線索。我發現this solution哪個鏈接到http://netty.io/wiki/forked-tomcat-native.html#wiki-h3-6

我認爲這可能不是我的目的(我只是想運行這些例子)。

所以我想知道任何Netty開發庫被下載到獲取啓動Netty應用程序開發。或者任何Pom.xml共享鏈接可以很容易地包含在示例項目中?謝謝。

+0

你是否試過[Force maven update]中的指示(https://stackoverflow.com/questions/4701532/force-maven -Update?RQ = 1)?它有助於緩存在本地存儲庫中,直到中央的更新時間間隔或更新被強制解決爲止,分辨率纔會被重新嘗試。 – Ferrybig

+0

是的。我已經嘗試過'mvn clean install -U'。錯誤仍然存​​在。 –

+0

我很困惑,它試圖下載「io.netty:netty-tcnative:jar:windows-x86 _ ** 32 **:1.1.33.Fork11」。你的設置像32位maven或類似的東西的任何奇怪的事情? – Ferrybig

回答

1

這個答案是根據Netty項目的bug report進行的。

要構建Netty項目,您應該將64位操作系統與64個JVM結合使用。這是因爲Netty項目使用的依賴項之一隻支持64位。

根據mvn -version的輸出,您在32位JVM上運行。您應該能夠從official java website下載64位JVM。

升級到64位JVM還提供了以下優點:

  • 你可以用超過2 GB的內存運行程序使用longdouble
  • 計算將更快Java可以使用本機處理器

差異之見:Benefits of 64bit java platform

你是不屬於R你自己也可以自己編譯例子,你也可以在Maven中心找到它們,按版本排列:http://central.maven.org/maven2/io/netty/netty-example/

1

望着日誌,它似乎沒有找到tcnative罐子

未能找到 io.netty:網狀-tcnative:罐子方式:windows-x86_32:1.1.33.Fork11在 https://repo.maven.apache.org/maven2被緩存在本地 庫,

你可以嘗試使用下面的Maven下載命令行此tcnative罐子:

mvn org.apache.maven.plugins:maven-dependency-plugin:get -DrepoUrl=http://central.maven.org/maven2/ -DgroupId=io.netty -DartifactId=netty-tcnative -Dversion=1.1.33.Fork11 
+0

它不起作用。我的身邊可以找到url http:// central.maven.org/maven2 /'。順便說一句,爲什麼我在你提到的url中找不到'netty-tcnative'或'tcnative'?謝謝。 –

+0

@ Joe.wang我的錯誤。我發佈了'-Dversion:'而不是'-Dversion ='。你現在可以嘗試嗎?我已經更新了命令。你也可以在[http://central.maven.org/maven2/io/netty/netty-tcnative/](http://central.maven.org/maven2/io/netty/netty -tcnative /) –

+0

真的有用!我也想知道https://repo.maven.apache.org/maven2提供的錯誤地址在哪裏?在我的maven設置或Netty源代碼項目中?謝謝。 –