首页 > 代码库 > Maven命令行创建web项目,并部署到jobss当中(解决No plugin found for prefix 'jboss-as' in the current project and in the plugin groups [org.apache.maven.plugins,问题)

Maven命令行创建web项目,并部署到jobss当中(解决No plugin found for prefix 'jboss-as' in the current project and in the plugin groups [org.apache.maven.plugins,问题)

  首件创建项目:此处可参照:http://maven.apache.org/guides/mini/guide-webapp.html 

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp

  将目录切换至my-webapp下,编译和打包:

mvn clean package

  此时,启动jboss服务器(我的是jboss-as-7.1.1),然后运行mvn clean jboss-as:deploy将web项目部署到jBoss当中。问题来了,终端报错了,信息如下:

No plugin found for prefix jboss-as in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (D:/Maven/m2/repository), central (http://repo.maven.apache.org/maven2)]

  解决方案:参照http://stackoverflow.com/questions/13956193/moving-to-jboss-as7-from-tomcat-mvn-jboss-asdeploy-does-not-work-on-my-maven-p 

  在项目的pom.xml中加入:

<plugins>        <plugin>            <groupId>org.jboss.as.plugins</groupId>            <artifactId>jboss-as-maven-plugin</artifactId>            <version>7.2.Final</version>        </plugin></plugins>

  再次编译打包,然后启动,结果如下图:

  备注:开源中国Maven源配置http://maven.oschina.net/help.html