使用Netbeans(和Maven)运行正确的上下文根 [英] Run with Netbeans (and Maven) the right context root

查看:249
本文介绍了使用Netbeans(和Maven)运行正确的上下文根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从Netbeans 7.2运行一个项目(我也使用一个Glassfish 3.1.2服务器)时,我遇到了一些问题...

实际上,我将现有的项目从Ant迁移到Maven,我的pom.xml已经完成,我已经使用了上下文根的定制,如下所述: http://maven.apache.org/plugins/maven-ear-plugin/examples/customizing-context-root.html ,但是当我从netbeans运行项目时,它的名字是.ear:
localhost:8080 / MyApplicationEAR-0.1-SNAPSHOT
而不是
localhost:8080 / MyApplicationName (它在< contextRoot> / MyApplicationName< / contextRoot>

如果我在浏览器中输入正确的URL,它可以正常工作,但它并不令人愉快。

Netbeans中有问题,或者我忘记了什么?

编辑:application.xml由Maven自动生成,context-root格式正确,但似乎Netbeans与此无关... 如果您正在使用Maven并部署到JBoss中,请尝试此操作。



>您应该编辑pom.xml文件并将以下行添加到< build> 部分中。

 < finalName> $ {的artifactId}< / finalName> 


I've got a little problem when I run a project from my Netbeans 7.2 (I also use a Glassfish 3.1.2 Server) ...

In fact I'm migrating existing projects from Ant to Maven, my pom.xml are finished and I've used the customisation of the context root as it's described here : http://maven.apache.org/plugins/maven-ear-plugin/examples/customizing-context-root.html but when I run the project from netbeans, it's deployed with the name of my .ear : localhost:8080/MyApplicationEAR-0.1-SNAPSHOT instead of localhost:8080/MyApplicationName (which is referenced in <contextRoot>/MyApplicationName</contextRoot>)

If I write the correct URL in my browser it works fine but it's not really pleasant.

Is there a problem in Netbeans or I've forgot something?

EDIT : The application.xml is auto generated by Maven and the context-root is well formed but it seems that Netbeans doesn't matter with this...

解决方案

If you are using Maven and deploying into JBoss, try this.

You should edit the pom.xml file and add the following line into <build> section.

<finalName>${artifactId}</finalName>

这篇关于使用Netbeans(和Maven)运行正确的上下文根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆