我在试着学习Spring。我想尝试的一件事是web mvc json setup正在做什么,但我得到了消息:
Command 'web mvc json setup' was found but is not currently available (type 'help' then ENTER to learn about this command)根本帮不上忙。我在医生里什么都没发现。
我在控制台中执行的步骤
C:\Betlista\tmp>mkdir RooJSONTest
C:\Betlista\tmp>cd RooJSONTest
C:\Betlista\tmp\RooJSONTest>roo
____ ____ ____
/ __ \/ __ \/ __ \
/ /_/ / / / / / / /
/ _, _/ /_/ / /_/ /
/_/ |_|\____/\____/ 1.3.2.RELEASE [rev 8387857]
Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.
Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
roo> project --topLevelPackage betlista.tests.roo.json --
project --topLevelPackage betlista.tests.roo.json --java project --topLevelPackage betlista.tests.roo.json --packaging
project --topLevelPackage betlista.tests.roo.json --parent project --topLevelPackage betlista.tests.roo.json --projectName
roo> project --topLevelPackage betlista.tests.roo.json --projectName RooJSONTest
Created ROOT\pom.xml
Created SRC_MAIN_RESOURCES
Created SRC_MAIN_RESOURCES\log4j.properties
Created SPRING_CONFIG_ROOT
Created SPRING_CONFIG_ROOT\applicationContext.xml
roo> web mvc setup
Created ROOT\src\main\webapp\WEB-INF\spring
Created ROOT\src\main\webapp\WEB-INF\spring\webmvc-config.xml
Created ROOT\src\main\webapp\WEB-INF\web.xml
Updated ROOT\src\main\webapp\WEB-INF\spring\webmvc-config.xml
Created ROOT\src\main\webapp\images
Created ROOT\src\main\webapp\images\add.png
Created ROOT\src\main\webapp\images\banner-graphic.png
Created ROOT\src\main\webapp\images\create.png
Created ROOT\src\main\webapp\images\delete.png
Created ROOT\src\main\webapp\images\favicon.ico
Created ROOT\src\main\webapp\images\list.png
Created ROOT\src\main\webapp\images\resultset_first.png
Created ROOT\src\main\webapp\images\resultset_last.png
Created ROOT\src\main\webapp\images\resultset_next.png
Created ROOT\src\main\webapp\images\resultset_previous.png
Created ROOT\src\main\webapp\images\show.png
Created ROOT\src\main\webapp\images\springsource-logo.png
Created ROOT\src\main\webapp\images\update.png
Created ROOT\src\main\webapp\styles
Created ROOT\src\main\webapp\styles\alt.css
Created ROOT\src\main\webapp\styles\standard.css
Created ROOT\src\main\webapp\WEB-INF\classes
Created ROOT\src\main\webapp\WEB-INF\classes\alt.properties
Created ROOT\src\main\webapp\WEB-INF\classes\standard.properties
Created ROOT\src\main\webapp\WEB-INF\layouts
Created ROOT\src\main\webapp\WEB-INF\layouts\default.jspx
Created ROOT\src\main\webapp\WEB-INF\layouts\layouts.xml
Created ROOT\src\main\webapp\WEB-INF\views
Created ROOT\src\main\webapp\WEB-INF\views\header.jspx
Created ROOT\src\main\webapp\WEB-INF\views\menu.jspx
Created ROOT\src\main\webapp\WEB-INF\views\footer.jspx
Created ROOT\src\main\webapp\WEB-INF\views\views.xml
Created ROOT\src\main\webapp\WEB-INF\views\dataAccessFailure.jspx
Created ROOT\src\main\webapp\WEB-INF\views\index-template.jspx
Created ROOT\src\main\webapp\WEB-INF\views\index.jspx
Created ROOT\src\main\webapp\WEB-INF\views\resourceNotFound.jspx
Created ROOT\src\main\webapp\WEB-INF\views\uncaughtException.jspx
Created ROOT\src\main\webapp\WEB-INF\tags\form
Created ROOT\src\main\webapp\WEB-INF\tags\form\create.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\dependency.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\find.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\list.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\show.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\update.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\fields
Created ROOT\src\main\webapp\WEB-INF\tags\form\fields\checkbox.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\fields\column.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\fields\datetime.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\fields\display.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\fields\editor.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\fields\input.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\fields\reference.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\fields\select.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\fields\simple.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\fields\table.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\form\fields\textarea.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\menu
Created ROOT\src\main\webapp\WEB-INF\tags\menu\category.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\menu\item.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\menu\menu.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\util
Created ROOT\src\main\webapp\WEB-INF\tags\util\language.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\util\load-scripts.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\util\pagination.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\util\panel.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\util\placeholder.tagx
Created ROOT\src\main\webapp\WEB-INF\tags\util\theme.tagx
Created ROOT\src\main\webapp\WEB-INF\i18n
Created ROOT\src\main\webapp\WEB-INF\i18n\messages.properties
Created ROOT\src\main\webapp\images\en.png
Updated ROOT\src\main\webapp\WEB-INF\i18n\application.properties
Updated ROOT\src\main\webapp\WEB-INF\web.xml
Updated ROOT\pom.xml [added dependencies org.springframework:spring-webmvc:${spring.version}, org.springframework.webflow:spring-js-resources:2.2.1.RELEASE, commons-digester:commons-digester:2.1, commons-fileupload:commons-fileupload:1.2.2, javax.servlet.jsp.jstl:jstl-api:1.2, org.glassfish.web:jstl-impl:1.2, javax.el:el-api:2.2, joda-time:joda-time:1.6, javax.servlet.jsp:jsp-api:2.1, commons-codec:commons-codec:1.5; updated project type to war; added property 'tomcat.version' = '7.0.63'; added plugin org.apache.tomcat.maven:tomcat7-maven-plugin:2.2; added plugin org.mortbay.jetty:jetty-maven-plugin:8.1.4.v20120524; added dependency org.apache.tiles:tiles-jsp:2.2.2]
Updated SRC_MAIN_WEBAPP\WEB-INF\views\footer.jspx
roo> web mvc json setup
Command 'web mvc json setup' was found but is not currently available (type 'help' then ENTER to learn about this command)发布于 2016-01-06 14:42:07
我找到了以下链接:http://dodero.github.io/sosc-wmf/Configuring%20JSON%20remoting.html
他们将这一问题描述如下:
.“由于Spring中一个尚未解决的问题,使用web JSON安装程序生成json控制器在运行一次web mvc设置以生成常规web控制器后不再工作.”
一个干净的解决方案是删除该项目并重新开始使用“项目--topLevelPackage.”但这一次没有运行"web设置“。
否则,您也可以尝试他们建议的解决方案:
"...To解决了这个问题,@RooWebJson标记可以添加到控制器中(例如PizzaController),而ROO将自动生成添加JSON实现的方面.“
但这对我没用。希望我能帮上忙。
发布于 2016-01-07 08:42:09
由于您可以检查弹簧Roo码,只有在创建了项目以及当前项目没有安装Spring MVC和JSF功能的情况下,命令web mvc json setup才可用。
public boolean isWebJsonInstallationPossible() {
return !projectOperations
.isFeatureInstalledInFocusedModule(FeatureNames.MVC)
&& !projectOperations
.isFeatureInstalledInFocusedModule(FeatureNames.JSF)
&& projectOperations.isFocusedProjectAvailable();
}在您提供的示例中,您要在执行web mvc setup之前执行web mvc json setup,所以(检查上面的代码)就是not found消息产生的原因。
尝试执行web mvc json setup命令而不是web mvc setup。
致以敬意,
https://stackoverflow.com/questions/34557206
复制相似问题