创建maven项目(cmd 命令)

时间:2023-03-08 17:18:25
创建maven项目(cmd 命令)

2016五月
22

创建maven项目(cmd 命令)

分类:maven

(994)
(0)

                      </p>
</div>
<div class="skin_detail" id="article_content">

1.普通方式创建

1)进入cmd窗口执行

mvn archetype:generate

2) 光标停止在 如下行

创建maven项目(cmd 命令)

此为选择项目类型:

创建java项目,选择默认按enter执行

创建web项目,输入webapp,进行筛选,选择一个输入编号,按enter执行

3)光标停在选择项目版本,按enter向下执行

4)  光标停在项目信息,输入包名,项目名,版本,包名,按enter执行

5)输入Y,创建成功!

2. 快捷创建java项目

1)进入cmd窗口执行

mvn archetype:generate -DgroupId=cn.luxh.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-
quickstart -DinteractiveMode=false

2)打包项目

mvn package (打包前会编译运行)

3)进入项目路径执行

java -cp target\my-app-1.0-SNAPSHOT.jar cn.luxh.app.App

3.快捷创建web项目

1)进入cmd窗口执行

mvn archetype:generate -DgroupId=cn.luxh.app -DartifactId=my-web-app -DarchetypeArtifactId=maven-archetype-webapp -DinteractivMode=false

4. maven web项目的运行

1)执行:mvn package 打成war包,放到tomcat下运行

2)引入tomcat 插件运行

a: 在pom.xml中添加maven-tomcat插件

创建maven项目(cmd 命令)

创建maven项目(cmd 命令)

b:执行: mvn tomcat:run

3)localhost:8080访问

                  </div>
</dd>
</dl>
</div>
<div class="skin_nav">
<div class="skin_edit"><i class="fa fa-th-list"></i>
<div class="nav_list nav_list_edit"><a href="/qq_24802337">文章列表</a></div>
</div> </div>
<div class="rssFix">
<a href="http://blog.csdn.net/qq_24802337/rss/list" class="column" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_RSS'])"><i class="fa fa-rss"></i></a>
</div> <div id="goTopBtn" class="skin_backTop"><i class="fa fa-chevron-up"></i></div>
</div>
<div class="detail_b">
<p class="reprint_copy" style="" id="copyright">版权声明:本文为博主原创文章,未经博主允许不得转载。</p>
<!--
<div class="bole" style="display:none">
<h2 class="bole_t clearfix"><span>伯乐推荐</span>
<label>一共有<em>{bolecount}</em>位博乐进行推荐</label>
</h2>
{bolecomment}
</div>
-->
<!-- style=""style=""-->
<h2 class="praise">
<label id="digg" articleid="51474190" onclick="btndigga();"><span id="btnDigg">顶</span><em>0</em></label>
<label id="bury" onclick="btnburya();"><span id="btnBury">踩</span><em>0</em></label>
</h2>
<div class="tracking-ad" data-mod="popu_222"><a href="javascript:void(0);" target="_blank">&nbsp;</a> </div>
<div class="tracking-ad" data-mod="popu_223"> <a href="javascript:void(0);" target="_blank">&nbsp;</a></div> <script type="text/javascript">
function btndigga() {
$(".tracking-ad[data-mod='popu_222'] a").click();
}
function btnburya() {
$(".tracking-ad[data-mod='popu_223'] a").click();
} $(function () {
if ($(".markdown_views").length > 0) {
$('pre.prettyprint code').each(function () {
var lines = $(this).text().split('\n').length;
var $numbering = $('<ul/>').addClass('pre-numbering').hide();
$(this).addClass('has-numbering').parent().append($numbering);
for (i = 1; i <= lines; i++) {
$numbering.append($('<li/>').text(i));
};
$numbering.fadeIn(1700);
});
}
else {
$("#article_content pre").each(function () {
var $this = $(this);
if ($this.attr("class") != undefined) {
if ($this.attr("class").indexOf("brush:") != -1) {
var lang = $this.attr("class").split(';')[0].split(':')[1];
$this.attr('name', 'code');
$this.attr('class', lang);
}
if ($this.attr("class")) {
$this.attr('name', 'code');
}
}
});
$('#article_content textarea[name=code]').each(function () {
var $this = $(this);
if ($this.attr("class").indexOf(":") != -1) {
$this.attr("class", $this.attr("class").split(':')[0]);
}
});
dp.SyntaxHighlighter.HighlightAll('code');
$('.highlighter').addClass('dp-highlighter');
if (!window.clipboardData) {
setTimeout("setCopyBtn()", 500);
} function __get_code_toolbar(snippet_id) {
return $("<span class='tracking-ad' data-mod='popu_167'><a href='https://code.csdn.net/snippets/"
+ snippet_id
+ "' target='_blank' title='在CODE上查看代码片' style='text-indent:0;'><img src='https://code.csdn.net/assets/CODE_ico.png' width=12 height=12 alt='在CODE上查看代码片' style='position:relative;top:1px;left:2px;'/></a></span>"
+ "<span class='tracking-ad' data-mod='popu_170'><a href='https://code.csdn.net/snippets/"
+ snippet_id
+ "/fork' target='_blank' title='派生到我的代码片' style='text-indent:0;'><img src='https://code.csdn.net/assets/ico_fork.svg' width=12 height=12 alt='派生到我的代码片' style='position:relative;top:2px;left:2px;'/></a></span>");
} $("[code_snippet_id]").each(function () {
__s_id = $(this).attr("code_snippet_id");
if (__s_id != null && __s_id != "" && __s_id != 0 && parseInt(__s_id) > 70020) {
__code_tool = __get_code_toolbar(__s_id);
$(this).prev().find(".tools").append(__code_tool);
}
}); $(".bar").show();
}
});
</script>
<div class="blog_share">
<!--<i class="fa fa-qq"></i><i class="fa fa-weixin"></i><i class="fa fa-weibo"></i><i class="fa fa-renren"></i><i class="fa fa-qq"></i><i class="fa fa-weixin"></i>
<i class="fa fa-weibo"></i><i class="fa fa-renren"></i>-->
<div class="bdsharebuttonbox tracking-ad bdshare-button-style0-16" style="float: right;" data-mod="popu_172" data-bd-bind="1483785787831">
<a href="#" class="bds_more" data-cmd="more" style="background-position:0 0 !important; background-image: url(http://bdimg.share.baidu.com/static/api/img/share/icons_0_16.png?v=d754dcc0.png) !important" target="_blank"></a>
<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间" style="background-position:0 -52px !important" target="_blank"></a>
<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博" style="background-position:0 -104px !important" target="_blank"></a>
<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博" style="background-position:0 -260px !important" target="_blank"></a>
<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网" style="background-position:0 -208px !important" target="_blank"></a>
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信" style="background-position:0 -1612px !important" target="_blank"></a>
</div>
<script>window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "1", "bdMiniList": false, "bdPic": "", "bdStyle": "0", "bdSize": "16" }, "share": {} }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
<!-- Baidu Button END -->
</div>
<div class="forward_back">
<div class="back fl"><a href="javascript:void(0);" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_shangyipian']);location.href='/qq_24802337/article/details/51473741';"><span><i class="fa fa-arrow-left"></i></span><em>maven 常用命令</em></a></div><div class="forward fr"><a href="javascript:void(0);" onclick="_gaq.push(['_trackEvent','function', 'onclick', 'blog_articles_xiayipian']);location.href='/qq_24802337/article/details/51475147';"><em>eclipse创建maven项目</em><span><i class="fa fa-arrow-right"></i></span></a></div>
</div>
<div>
<ins data-revive-zoneid="71" data-revive-id="8c38e720de1c90a6f6ff52f3f89c4d57"></ins>
</div>
<!--
{articleinsamecategory}
-->
<div class="comment" id="comment_form">
<div id="commentsbmitarear"><div class="guest_link">您还没有登录,请<a href="javascript:void(0);" onclick="javascript:loginbox();">[登录]</a>或<a href="http://passport.csdn.net/account/register?from=http%3A%2F%2Fblog.csdn.net%2Fqq_24802337%2Farticle%2Fdetails%2F51474190">[注册]</a></div></div>
<a name="comments"></a>
<div class="comment_list" id="comment_list"><br>&nbsp;&nbsp;暂无评论<br><br><div class="clear"></div></div>
<div style="height:60px">&nbsp;</div>
</div>
</div>
</div>
posted @
2017-01-07 18:45 
jobs-lgy 
阅读(...) 
评论(...) 
编辑 
收藏

markdown_highlight();

var allowComments = false, cb_blogId = 317248, cb_blogApp = 'jobs-lgy', cb_blogUserGuid = 'f2023aea-afab-e611-845c-ac853d9f53ac';
var cb_entryId = 6260025, cb_entryCreatedDate = '2017-01-07 18:45', cb_postType = 1;
loadViewCount(cb_entryId);
loadSideColumnAd();

var commentManager = new blogCommentManager();
commentManager.renderComments(0);

var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];

googletag.cmd.push(function () {
googletag.defineSlot("/1090369/C1", [300, 250], "div-gpt-ad-1546353474406-0").addService(googletag.pubads());
googletag.defineSlot("/1090369/C2", [468, 60], "div-gpt-ad-1539008685004-0").addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});

fixPostBody();
deliverBigBanner();
setTimeout(function() { incrementViewCount(cb_entryId); }, 50); deliverAdT2();
deliverAdC1();
deliverAdC2();
loadNewsAndKb();
loadBlogSignature();
LoadPostCategoriesTags(cb_blogId, cb_entryId); LoadPostInfoBlock(cb_blogId, cb_entryId, cb_blogApp, cb_blogUserGuid);
GetPrevNextPost(cb_entryId, cb_blogId, cb_entryCreatedDate, cb_postType);
loadOptUnderPost();
GetHistoryToday(cb_blogId, cb_blogApp, cb_entryCreatedDate);