首页 新闻 会员 周边 捐助

pom都已配置好,为什么libraries中没有maven下载的包

0
[已解决问题] 解决于 2017-10-25 08:31

下面是报的异常:

Error:(10, 34) java: 找不到符号
符号: 类 ActionSupport
Error:(6, 52) java: 程序包org.springframework.beans.factory.annotation不存在
Error:(5, 31) java: 程序包com.opensymphony.xwork2不存在
Error:(7, 38) java: 程序包org.springframework.stereotype不存在
Error:(9, 2) java: 找不到符号
符号: 类 Controller
Error:(11, 6) java: 找不到符号
符号: 类 Autowired
位置: 类 com.dazhi.controller.LoginAction
Error:(3, 21) java: 程序包org.hibernate不存在
E:\new_o2o\o2ostudy_parent\o2ostudy_admin\src\main\java\com\dazhi\core\impl\AbstractBaceDao.java
Error:(4, 21) java: 程序包org.hibernate不存在
Error:(19, 5) java: 找不到符号
符号: 类 SessionFactory
位置: 类 com.dazhi.core.impl.AbstractBaceDao<T>
Error:(5, 52) java: 程序包org.springframework.beans.factory.annotation不存在
Error:(21, 35) java: 找不到符号
符号: 类 SessionFactory
位置: 类 com.dazhi.core.impl.AbstractBaceDao<T>
Error:(18, 6) java: 找不到符号
符号: 类 Autowired
位置: 类 com.dazhi.core.impl.AbstractBaceDao<T>

下面是common中maven配置:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>o2ostudy_parent</artifactId>
<groupId>com.dazhi</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>o2ostudy-common</artifactId>
<packaging>jar</packaging>

<name>o2ostudy-common</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>4.3.11.RELEASE</spring.version>
<hibernate.version>4.3.11.Final</hibernate.version>
<struts.version>2.3.34</struts.version>
<thymeleaf.version>3.0.3.RELEASE</thymeleaf.version>

</properties>

<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>RELEASE</version>
</dependency>

<!-- LOG相关 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.2</version>
</dependency>
<!-- 日志 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.12</version>
</dependency>
<!-- Struts-->
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-json-plugin</artifactId>
<version>${struts.version}</version>
</dependency>
<!-- Hibernate-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>

<!-- spring 相关 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.3.34</version>
</dependency>


<!-- https://mvnrepository.com/artifact/c3p0/c3p0 -->
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- AOP 相关-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>4.3.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.11</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.6.11</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.1_3</version>
</dependency>


<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.44</version>
</dependency>
<!-- spring session-->
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
<version>1.3.0.RELEASE</version>
</dependency>
<!-- redis -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.7.5.RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!-- 工具相关 -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>

</dependencies>
</project>
下面是admin中pom.xml的配置:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>o2ostudy_parent</artifactId>
<groupId>com.dazhi</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>o2ostudy-admin</artifactId>
<packaging>war</packaging>
<name>o2ostudy-admin Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.dazhi</groupId>
<artifactId>o2ostudy-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.struts.xwork</groupId>
<artifactId>xwork-core</artifactId>
<version>2.3.34</version>
</dependency>

</dependencies>
<build>
<finalName>o2ostudy-admin</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>请问为什么libraries中没有jar包,这种问题该怎么解决


键盘碎了的主页 键盘碎了 | 菜鸟二级 | 园豆:206
提问于:2017-10-24 14:26
< >
分享
最佳答案
0

报错提示是缺少依赖,是不是项目需要的依赖没有下载到中央仓库。

奖励园豆:5
ycyzharry | 高人七级 |园豆:25683 | 2017-10-24 15:30

对啊,可是为什么没下载呢?

键盘碎了 | 园豆:206 (菜鸟二级) | 2017-10-24 15:40

这样的问题该怎么解决呢

 

键盘碎了 | 园豆:206 (菜鸟二级) | 2017-10-24 15:41

@键盘碎了: eclipse重启,要是还没有下载换个好的网络,再报错就检查出具体是缺少哪个jar。还可以单独第三方引入,参考http://www.cnblogs.com/ycyzharry/p/6695093.html

ycyzharry | 园豆:25683 (高人七级) | 2017-10-24 15:43
其他回答(1)
0

首先你需要确保你的机子里面有maven,其次你需要讲这个项目maven的setting文件路径和本地仓库路径设置好,然后确保有网络,而且你的网络能访问到你需要的依赖包所在的远程仓库(访问没有被限制),如果下载好了,pom文件里面的依赖会由红变正常

The_shy | 园豆:210 (菜鸟二级) | 2017-10-25 09:45
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册