maven导入项目的一些问题

今天将maven重新装了一遍,发现以前的许多问题就没有再出现了,所以,当你用maven的时候发现问题比较多,搞不定的时候,建议重新安装一遍。因为maven是个自动标准化的东西,很多东西不好改动,重装是比较好的选择。安装和集成myeclipse2015的教程,可以参考下面的链接,但是我只试过安装maven和集成2015的步骤,其他的步骤不确定是不是正确的,慎用。链接如下:
http://blog.sina.com.cn/s/blog_9ad12ac20102vzlo.html

下面把自己遇到的问题的解决方法分享给大家,有用的话可以点个赞,还不知道csdn的赞有啥用~~:
1.json文件报错
如果是导入的项目,一般文件内容是不会错的,应该是校验的问题。
Window > Preferences > MyEclipse > Validation > 右侧将“JSON Validator”关闭即可。

2.Class “xxxx” is managed, but is not listed in the persistence.xml file
JPA的问题,本质原因是:JPA项目会用JPA的规则进行验证,所以就会报错。右键persistence.xml file,找到JPA tools,Synchronize Class List.实在不行,只能忽略看看:Select: (Your Project) -> Properties -> JPA;
eclipse下: Look for “Persistent class management” and select the option “Discover annotated classes automatically”;
myeclipse2015下:jpa下的type,找到class is managed

3.terget entity “xxx” is not an Entity
问题本质同:class “xxx” is managed,but it is not listed in persistence.xml
在JPA中修改

4.cvc-complex-type.2.4.a:invalid content
解决办法为:将“http://www.springmodules.org/schema/cache/springmodules-cache.xsd http://www.springmodules.org/schema/cache/springmodules-ehcache.xsd”这段话加入到xml文件的”xmlns:xsi=”的标签中
转自:http://blog.csdn.net/niu_hao/article/details/25250213

cvc-complex-type.2.4.c
可能是网络问题,还没遇到过

5.install时无法失败:Could not resolve dependencies for project com.
install是有顺序的,先parent

6。jar:0.0.1-SNAPSHOT is missing, no dependency information available
同5

  1. Referenced file contains errors(xxx)。括号内的问题分两种:一种直接提示到本地路径的,一直提示www的。
    本地的:直接进入将对应的xsd删除(如果不行可以尝试:打开Preferences -> General -> Network Connections -> Cache,清除缓存,重启,重新maven-update project)
    www的:一般是有空格,这里一般是写法不规范引起的,建议将每个www都回车分行

8.Could not find artifact xxx
一般是maven下载失败导致,我这边比较常见的是jdbc导不下来。
Properties-java build path-maven dependencies 找到包,重新下,或从别人哪里拷贝。

其他一些我没遇到的过的问题可以参考:http://blog.csdn.net/heweirun_2014/article/details/46558329

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:oscache="http://www.springmodules.org/schema/oscache" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springmodules.org/schema/oscache http://www.springmodules.org/schema/cache/springmodules-oscache.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"> <!-- 对web包中的所有类进行扫描,以完成Bean创建和自动依赖注入的功能 mvc:annotation-driven --> <mvc:annotation-driven/> <!-- 扫描包 --> <context:annotation-config/> <context:component-scan base-package="com.org.*" /> <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <property name="prefix" value="/jsp/" /> <property name="suffix" value=".jsp" /> </bean> <!-- 配置jdbc --> <bean class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer"> <property name="locations"> <value>classpath:properties/jdbc.properties</value> </property> </bean> <!-- 配置數據源 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="${jdbc.driver}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <!-- 连接池启动时的初始值 --> <property name="initialSize" value="1"/> <property name="maxActive" value="500"/> <property name="maxIdle" value="2"/> <property name="minIdle" value="1"/> </bean> <!-- 配置sessionFactory 注解配置 org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean 配置形式: org.springframework.orm.hibernate3.LocalSessionFactoryBean --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="packagesToScan"> <list> <value>com.org.entity</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> <!-- 配置hibernateTemplate --> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- Spring AOP config配置切点 --> <aop:config> <aop:pointcut expression="execution(public * com.org.service.*.*(..))" id="bussinessService" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="bussinessService" /> </aop:config> <!-- 配置那个类那个方法用到事务处理 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="get*" read-only="true" /> <tx:method name="add*" propagation="REQUIRED" /> <tx:method name="update*" propagation="REQUIRED" /> <tx:method name="delete*" propagation="REQUIRED" /> <tx:method name="*" propagation="REQUIRED" /> </tx:attributes> </tx:advice> <!-- 这个映射配置主要是用来进行静态资源的访问 --> <mvc:resources mapping="/js/**" location="/js/" cache-period="31556926"/> <mvc:resources mapping="/resource/**" location="/resource/" /> <mvc:resources mapping="/jsp/**" location="/jsp/" /> </beans>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值