[英]idea intellij maven project can't make
I have maven project. 我有maven项目。 Maven build complete SUCCESS.
Maven构建完整的SUCCESS。 But i can't make this project.
但我不能做这个项目。
[INFO] BUILD SUCCESS [信息]建立成功
Project contains one module. 项目包含一个模块。 Idea can't see dependencies.
Idea无法看到依赖关系。
Error:(3, 38) java: D:\Dropbox\Programming\java\spring\springBook\src\main\java\ch14\validator\ContactTestValidator.java:3:
package org.springframework.stereotype does not exist
POM: POM:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>springBook</groupId>
<artifactId>springBook</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- Shared version number properties -->
<properties>
<org.springframework.version>3.2.3.RELEASE</org.springframework.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<!--для валидации бинов необходима-->
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<!--Spring Data JPA использует его - добавим и пользуемся-->
<!--API для работы с датами-->
<!--ch14 validator-->
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<!--ch14 validator-->
<!--API интерфейса JSR-303-->
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<!--ch14 validator-->
<!--API, которая поддерживает интерфейс JSR-303 - BeanValidation-->
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.0.2.GA</version>
</dependency>
<dependency>
<!--для валидации. (@Type...)-->
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.6-Final</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.6.2</version>
</dependency>
<!--Spring framework-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${org.springframework.version}</version>
</dependency>
</dependencies>
<build>
<finalName>springBook</finalName>
</build>
</project>
Could you help me? 你可以帮帮我吗? Unfortunately, I can't add screenshots.. There are screenshots: http://screencast.com/t/iNaWO9gy http://screencast.com/t/iBGTyMpgH
不幸的是,我无法添加截图..有截图: http : //screencast.com/t/iNaWO9gy http://screencast.com/t/iBGTyMpgH
Project settings - Libraries - empty; 项目设置 - 图书馆 - 空;
reimport didn't help; 重新进口没有帮助;
Do the following steps: 执行以下步骤:
Option Maven -> Reimport
should force Intellij to reload all dependencies. 选项
Maven -> Reimport
应强制Intellij重新加载所有依赖项。 Alternatively, as mentioned in comments you can click the Reimport All Maven Projects
button in Maven Projects
view. 或者,如评论中所述,您可以单击
Maven Projects
视图中的Reimport All Maven Projects
按钮。
In my case, I had my own apache-maven-3.5.2 folder and a misconfiguration created my problem. 在我的情况下,我有自己的apache-maven-3.5.2文件夹,错误配置造成了我的问题。 Maybe it's your case too:
也许这也是你的情况:
In rush, I set the local repository to C:/my/folder/apache-maven-3.5.2/settings.xml, but it must be a folder so Maven didn't allow me to download the dependencies. 急,我将本地存储库设置为C:/my/folder/apache-maven-3.5.2/settings.xml,但它必须是一个文件夹,因此Maven不允许我下载依赖项。 Then I changed the default (in the picture) and it worked.
然后我改变了默认值(在图片中)并且它有效。
打开模块依赖项(按模块上的F12),转到Modules -> Dependencies
,并确保maven导入是其中的一部分。
如果此答案对您没有帮助,请尝试从源中导入项目。
The following worked for me. 以下对我有用。
I had faced the same problem, and the issue was small. 我遇到了同样的问题,问题很小。 I had changed the location of settings.xml file of maven and Intellij was picking up the default from C:\\users\\.m2\\settings.xml
我更改了maven的settings.xml文件的位置,Intellij从C:\\ users \\ .m2 \\ settings.xml中获取了默认值
So point your maven settings.xml to the correct file as below: File--> Settings--> Build, Execution, Deployment--> Maven then on the right window, override "User settings file" to the settings.xml where you have in your local disk. 所以将maven settings.xml指向正确的文件,如下所示:文件 - >设置 - >构建,执行,部署 - > Maven然后在右侧窗口,将“用户设置文件”覆盖到您在的settings.xml中拥有本地磁盘。
If you have installed maven in a non-default location then this file you can find in: \\apache-maven-3.2.3\\conf\\settings.xml 如果您已在非默认位置安装了maven,则可以在以下位置找到此文件:\\ apache-maven-3.2.3 \\ conf \\ settings.xml
右键单击pom.xml
,然后单击Add as Maven Project
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.