我无法向 ROO 2.0.0.M3 添加新语言

I can't add a new language to ROO 2.0.0.M3

您好,我也遇到了安装新语言的问题。

建立一个新消息属性文件 我在 roo shell 中用 messages_de.properties.

创建了语言插件

addon create i18n --topLevelPackage org.springframework.roo.addon.web.mvc.i18n --locale de --messageBundle messages_de.properties

我将使用 maven 创建一个 jar

mvn 全新安装

第一个问题

Downloading: https://repo.maven.apache.org/maven2/org/springframework/roo/org.springframework.roo.ad
don.web.mvc.jsp/2.0.0.M3/org.springframework.roo.addon.web.mvc.jsp-2.0.0.M3.pom
[WARNING] The POM for org.springframework.roo:org.springframework.roo.addon.web.mvc.jsp:jar:2.0.0.M3
 is missing, no dependency information available
Downloading: https://repo.maven.apache.org/maven2/org/springframework/roo/org.springframework.roo.ad
don.web.mvc.jsp/2.0.0.M3/org.springframework.roo.addon.web.mvc.jsp-2.0.0.M3.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.043 s
[INFO] Finished at: 2017-03-02T07:08:50+01:00
[INFO] Final Memory: 12M/182M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project org.springframework.roo.addon.web.mvc.i18n.languages: Coul
d not resolve dependencies for project org.springframework.roo.addon.web.mvc.i18n.languages:org.spri
ngframework.roo.addon.web.mvc.i18n.languages:bundle:0.1.0.BUILD-SNAPSHOT: Could not find artifact or
g.springframework.roo:org.springframework.roo.addon.web.mvc.jsp:jar:2.0.0.M3 in central (https://rep
o.maven.apache.org/maven2) -> [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 arti
cles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

我在 maven 存储库上显示,只有 ROO 2.0.0.M1 的 jar,我使用 M3 然后我更改 pom.xml set

<dependency>
   <groupId>org.springframework.roo</groupId>
   <artifactId>org.springframework.roo.addon.web.mvc.jsp</artifactId>
   <version>2.0.0.M1</version>
</dependency>

构建了一个 jar。

我会把这个 jar 作为插件安装。

我在start roo的文件夹中复制的jar。 我正在研究 Windows。 但是命令不起作用

在 roo shell 类型

我测试 插件安装 url --url 文件:\\org.springframework.roo.addon.web.mvc.i18n.languages-0.1.0.BUILD -SNAPSHOT.jar

堆栈跟踪:

Illegal character in opaque part at index 5: file:\org.springframework.roo.addon.web.mvc.i18n.langua
ges-0.1.0.BUILD-SNAPSHOT.jar
java.lang.IllegalArgumentException: Illegal character in opaque part at index 5: file:\org.springfra
mework.roo.addon.web.mvc.i18n.languages-0.1.0.BUILD-SNAPSHOT.jar
    at java.net.URI.create(Unknown Source)
    at java.net.URI.resolve(Unknown Source)
    at org.apache.felix.gogo.command.Util.resolveUri(Util.java:522)
    at org.apache.felix.gogo.command.Basic.install(Basic.java:433)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:137)
    at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)
    at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)
    at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)
    at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)
    at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)
    at org.springframework.roo.felix.FelixDelegator.perform(FelixDelegator.java:110)
    at org.springframework.roo.felix.FelixDelegator.shell(FelixDelegator.java:70)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.callback(Proc
essManagerHostedExecutionStrategy.java:48)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(Defa
ultProcessManager.java:307)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcess
Manager.java:67)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(Process
ManagerHostedExecutionStrategy.java:45)
    at org.springframework.roo.shell.AbstractShell.executeCommandImpl(AbstractShell.java:306)
    at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:218)
    at org.springframework.roo.obr.addon.search.ObrAddonSearchOperationsImpl.installAddOnByUrl(ObrAd
donSearchOperationsImpl.java:457)
    at org.springframework.roo.obr.addon.search.ObrAddOnCommands.installByUrl(ObrAddOnCommands.java:
46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.callback(Proc
essManagerHostedExecutionStrategy.java:48)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(Defa
ultProcessManager.java:307)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcess
Manager.java:67)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(Process
ManagerHostedExecutionStrategy.java:45)
    at org.springframework.roo.shell.AbstractShell.executeCommandImpl(AbstractShell.java:306)
    at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:218)
    at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:417)
    at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:547)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 5: file:\org.sprin
gframework.roo.addon.web.mvc.i18n.languages-0.1.0.BUILD-SNAPSHOT.jar
    at java.net.URI$Parser.fail(Unknown Source)
    at java.net.URI$Parser.checkChars(Unknown Source)
    at java.net.URI$Parser.parse(Unknown Source)
    at java.net.URI.<init>(Unknown Source)
    ... 43 more
org.osgi.framework.BundleException: Unable to cache bundle: file:\org.springframework.roo.addon.web.
mvc.i18n.languages-0.1.0.BUILD-SNAPSHOT.jar
    at org.apache.felix.framework.Felix.installBundle(Felix.java:2975)
    at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:167)
    at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:140)
    at org.apache.felix.gogo.command.Basic.start(Basic.java:734)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:137)
    at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)
    at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)
    at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)
    at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)
    at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)
    at org.springframework.roo.felix.FelixDelegator.perform(FelixDelegator.java:110)
    at org.springframework.roo.felix.FelixDelegator.shell(FelixDelegator.java:70)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.callback(Proc
essManagerHostedExecutionStrategy.java:48)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(Defa
ultProcessManager.java:307)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcess
Manager.java:67)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(Process
ManagerHostedExecutionStrategy.java:45)
    at org.springframework.roo.shell.AbstractShell.executeCommandImpl(AbstractShell.java:306)
    at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:218)
    at org.springframework.roo.obr.addon.search.ObrAddonSearchOperationsImpl.installAddOnByUrl(ObrAd
donSearchOperationsImpl.java:458)
    at org.springframework.roo.obr.addon.search.ObrAddOnCommands.installByUrl(ObrAddOnCommands.java:
46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.callback(Proc
essManagerHostedExecutionStrategy.java:48)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(Defa
ultProcessManager.java:307)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcess
Manager.java:67)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(Process
ManagerHostedExecutionStrategy.java:45)
    at org.springframework.roo.shell.AbstractShell.executeCommandImpl(AbstractShell.java:306)
    at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:218)
    at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:417)
    at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:547)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: \org.springframework.roo.addon.web.mvc.i18n.languages-0.1.
0.BUILD-SNAPSHOT.jar (Das System kann die angegebene Datei nicht finden)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
    at org.apache.felix.framework.util.SecureAction.getURLConnectionInputStream(SecureAction.java:52
5)
    at org.apache.felix.framework.cache.JarRevision.initialize(JarRevision.java:166)
    at org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:77)
    at org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:
878)
    at org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:550)
    at org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:153)
    at org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:277)
    at org.apache.felix.framework.Felix.installBundle(Felix.java:2971)
    ... 42 more
java.io.FileNotFoundException: \org.springframework.roo.addon.web.mvc.i18n.languages-0.1.0.BUILD-SNA
PSHOT.jar (Das System kann die angegebene Datei nicht finden)

为什么最后没有找到文件异常是怎么回事?

我测试 插件安装 url --url file://org.springframework.roo.addon.web.mvc.i18n.languages-0.1.0.BUILD -SNAPSHOT.jar

并获取堆栈跟踪:

java.io.IOException: Server returned HTTP response code: 503 for URL: ftp://org.springframework.roo.
addon.web.mvc.i18n.languages-0.1.0.BUILD-SNAPSHOT.jar

org.osgi.framework.BundleException: Unable to cache bundle: file://org.springframework.roo.addon.web
.mvc.i18n.languages-0.1.0.BUILD-SNAPSHOT.jar
    at org.apache.felix.framework.Felix.installBundle(Felix.java:2975)
    at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:167)
    at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:140)
    at org.apache.felix.gogo.command.Basic.start(Basic.java:734)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.felix.gogo.runtime.Reflective.invoke(Reflective.java:137)
    at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)
    at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)
    at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)
    at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)
    at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)
    at org.springframework.roo.felix.FelixDelegator.perform(FelixDelegator.java:110)
    at org.springframework.roo.felix.FelixDelegator.shell(FelixDelegator.java:70)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.callback(Proc
essManagerHostedExecutionStrategy.java:48)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(Defa
ultProcessManager.java:307)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcess
Manager.java:67)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(Process
ManagerHostedExecutionStrategy.java:45)
    at org.springframework.roo.shell.AbstractShell.executeCommandImpl(AbstractShell.java:306)
    at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:218)
    at org.springframework.roo.obr.addon.search.ObrAddonSearchOperationsImpl.installAddOnByUrl(ObrAd
donSearchOperationsImpl.java:458)
    at org.springframework.roo.obr.addon.search.ObrAddOnCommands.installByUrl(ObrAddOnCommands.java:
46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.callback(Proc
essManagerHostedExecutionStrategy.java:48)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(Defa
ultProcessManager.java:307)
    at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcess
Manager.java:67)
    at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(Process
ManagerHostedExecutionStrategy.java:45)
    at org.springframework.roo.shell.AbstractShell.executeCommandImpl(AbstractShell.java:306)
    at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:218)
    at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:417)
    at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:547)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: ftp://org.springfra
mework.roo.addon.web.mvc.i18n.languages-0.1.0.BUILD-SNAPSHOT.jar
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(Unknown Source)
    at org.apache.felix.framework.util.SecureAction.getURLConnectionInputStream(SecureAction.java:52
5)
    at org.apache.felix.framework.cache.JarRevision.initialize(JarRevision.java:166)
    at org.apache.felix.framework.cache.JarRevision.<init>(JarRevision.java:77)
    at org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:
878)
    at org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:550)
    at org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:153)
    at org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:277)
    at org.apache.felix.framework.Felix.installBundle(Felix.java:2971)
    ... 42 more
java.io.IOException: Server returned HTTP response code: 503 for URL: ftp://org.springframework.roo.
addon.web.mvc.i18n.languages-0.1.0.BUILD-SNAPSHOT.jar

我想我不能用 addon install url --url file:\... 或 file://... 安装插件 文件在此命令中不起作用。 我使用 osgi 命令的旧版本 Roo 我找到了 osgi start 的示例 --url file:///foo.jar

http://docs.spring.io/spring-roo/reference/html/simple-addons.html

但是 osgi 命令不起作用或找不到。

另一个问题 我测试使用 osgi 命令安装(就像在 roo 的旧版本中一样)但是找不到 osgi 命令。

我输入

roo> help osgi

COMMAND INDEX


** Type 'hint' (without the quotes) and hit ENTER for step-by-step guidance **

roo> osgi start --url file:///org.springframework.roo.addon.web.mvc.i18n.languages-0.1.0.BUILD-SNAPS
HOT.jar
Command 'osgi start --url file:///org.springframework.roo.addon.web.mvc.i18n.languages-0.1.0.BUILD-S
NAPSHOT.jar' not found (for assistance press TAB or type "hint" then hit ENTER)
Searching 'osgi start' on installed repositories
0 matches found with 'osgi start' on installed repositories

另一个语言测试 我在 org.springframework.roo.addon.web.mvc.i18n-2.0.0.M3.jar 等相同的包结构中添加了构建语言,并将构建的 class、gramen 的消息属性和图像放在另一个 jar 中语言存在。这不起作用,当我在现有项目中键入 web mvc 语言 --code 时不显示新语言。

抱歉我的延迟回复。我正在检查您的问题以了解问题所在。

关于编译问题,我刚刚在下面的commit中解决了。

https://github.com/spring-projects/spring-roo/commit/2a332a991e16796c38180213d75666f41e6b1b86

此修复程序将包含在将于本周发布的 Spring Roo 2.0.0.RC1 版本中。

关于新.jar的安装过程,您应该使用以下命令:

roo> addon install url --url file:///home/jcagarcia/.m2/repository/org/jcagarcia/i18n/de/org.jcagarcia.i18n.de/0.1.0.BUILD-SNAPSHOT/org.jcagarcia.i18n.de-0.1.0.BUILD-SNAPSHOT.jar
Bundle ID: 92

如您所见,插件安装过程正常。

使用此命令时请记住以下提示:

  • 不要在创建 addon language 的同一文件夹下执行 Spring Roo shell。
  • 您必须指明 .jar 文件的完整路径
    • Linux路径:file:///home/jcagarcia/.m2/repository/org/jcagarcia/i18n/de/org.jcagarcia.i18n.de/0.1.0.BUILD-SNAPSHOT/org.jcagarcia.i18n.de-0.1.0.BUILD-SNAPSHOT.jar
    • Windows路径:file:///C://Users/jcagarcia/Desktop/org.jcagarcia.i18n.de-0.1.0.BUILD-SNAPSHOT.jar

希望对您有所帮助!