初学SSH + maven的那点事

1. 项目构建
项目结构
配置文件及前端页面

2. 遇到过得的问题

one:maven项目Java resources 上面有个红叉但是代码里面并没有什么报错

解决办法:1.通过: windows菜单 -> show view/other 菜单 -> other菜单
在弹出的窗口中,搜索 Problems窗口。
2.然后运行程序/或者在Problems窗口中,你会发现 红色的警告,这些就是反映的错误,修复它们,即可。

two:误删了target文件

解决办法:
1.进入本地仓库的repository\org\apache\maven\plugins文件下

2.删除所有plugin

3.重启eclipse

4.重新clean 、install

three: Maven打包web项目报错Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if

原因:maven的web项目默认的webroot是在src\main\webapp。如果在此目录下找不到web.xml就抛出以上的异常
解决办法:
1.将webroot修改为webapp
2.在pom.xml中指定web.xml,如下:

<build>
    <finalName>web-app-name</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <webXml>webapp\WEB-INF\web.xml</webXml>
            </configuration>
        </plugin>
    </plugins>
</build>

four: maven clean报maven-clean-plugin:2.5 one of its dependencies could not be 下载

经历了反复的clean-build、maven force update及各种可能想得到的操作,某些依赖包依然无法下载。
解决办法:在settings.xml中加入如下代码

<mirrors>
    <mirror>
        <id>nexus</id>
        <mirrorOf>central</mirrorOf>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>
</mirrors>

four: maven clean报maven-clean-plugin:2.5 one of its dependencies could not be 下载

原因:hibernate.hql是对类进行查询的
解决办法:纠正hql语句,将表名改为类名,EMPLOYEES是表名,Employee是类名,所以要改成
session.createQuery(“from Employee”).list().iterator();
在这里插入图片描述

**

six: maven-clean-plugin:2.5 one of its dependencies could not be 下载

setting加入如下配置
**

<mirrors>
  <mirror>
       <id>nexus</id>
       <name>internal nexus repository</name>
       <!-- <url>http://192.168.1.100:8081/nexus/content/groups/public/</url>-->
       <url>http://repo.maven.apache.org/maven2</url>
       <mirrorOf>central</mirrorOf>
   </mirror>
</mirrors>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值