Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Maven:尝试使用依赖项在另一个项目中包含项目时找不到工件 问题描述_Java_Eclipse_Spring_Maven - Fatal编程技术网

Java Maven:尝试使用依赖项在另一个项目中包含项目时找不到工件 问题描述

Java Maven:尝试使用依赖项在另一个项目中包含项目时找不到工件 问题描述,java,eclipse,spring,maven,Java,Eclipse,Spring,Maven,我有一个名为reservationVol的项目,我想将它包含在一个名为reservationVolMvc的mvc spring项目中。我在eclipse上编译并测试了reservationVol。我还使用maven命令:mvncilee和mvnpackage。所有测试都成功运行 当我尝试使用mvn compile命令编译reservationVolMvc时,我得到以下错误: [INFO] Scanning for projects... [INFO]

我有一个名为
reservationVol
的项目,我想将它包含在一个名为
reservationVolMvc
的mvc spring项目中。我在eclipse上编译并测试了
reservationVol
。我还使用maven命令:
mvncile
e和
mvnpackage
。所有测试都成功运行

当我尝试使用mvn compile命令编译
reservationVolMvc
时,我得到以下错误:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building reservationVolSpring 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for hani.reservationVol:reservationVol:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.688 s
[INFO] Finished at: 2016-11-23T12:25:21+01:00
[INFO] Final Memory: 6M/77M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project reservationVolSpring: Could not resolve dependencies for project formation.addstones:reservationVolSpring:war:1.0-SNAPSHOT: Could not find artifact hani.reservationVol:reservationVol:jar:1.0-SNAPSHOT -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
以下pom.xml文件分别表示
reservationVol
reservationVolMvc
的依赖关系。我使用以下方法将项目
ReservationVol
包括在
reservationVolMvc
中:

<dependency>
    <groupId>hani.reservationVol</groupId>
    <artifactId>reservationVol</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

哈尼预订量
预订量
1.0-快照

预订量

4.0.0
哈尼预订量
预订量
罐子
1.0-快照
预订量
mysql
mysql连接器java
5.1.39
编译
org.hibernate
冬眠核心
5.1.0.1最终版本
org.hibernate
休眠实体管理器
5.1.0.1最终版本
org.springframework
spring上下文
4.2.6.1发布
org.springframework
春季甲虫
4.2.6.1发布
org.apache.commons
commons-dbcp2
2.1.1
朱尼特
朱尼特
4.12
测试
org.springframework
弹簧试验
4.2.5.1发布
org.apache.maven.plugins
maven编译器插件
3.3
1.8
1.8

预订VOLMVC

4.0.0
形成
沃斯普林酒店
战争
1.0-快照
沃斯普林酒店
哈尼预订量
预订量
1.0-快照
com.fasterxml.jackson.core
杰克逊数据绑定
2.7.5
jstl
jstl
1.2
javax.servlet.jsp
jsp api
2.2
javax.servlet
javax.servlet-api
3.1.0
org.springframework
spring上下文
4.2.6.1发布
org.springframework
SpringWebMVC
4.2.6.1发布
javax.validation
验证api
1.0.0.GA
org.hibernate
休眠验证器
4.3.2.最终版本
org.apache.maven.plugins
maven编译器插件
3.5.1
1.8
1.8

执行
mvn清洁安装


这将清除以前构建中创建的任何内容,然后构建您的项目并将JAR添加到本地maven存储库(.m2\repository)

我也遇到了同样的问题…………问题得到了解决
执行maven清理并安装子项目,然后重试

maven清理并安装父项目

请观看这些视频以供参考

我也面临着同样的问题,我有一个父项目,它在独立项目的干净安装中会失败

我尝试了上述所有解决方案,但都没有成功,在eclipse中和从命令行运行clean install

我可以通过导航到子项目并运行以下命令来解决这个问题

  • 清理项目
    mvn clean
  • 设置为eclipse项目
    mvn eclipse:eclipse
    (强制下载丢失的JAR)
  • 然后是子项目的干净安装
    mvn干净安装-U
  • 最后在父项目上进行清理安装
    mvn清理安装-DskipTests-P(如果需要,在此处提供一个概要文件)-U
  • 当maven没有下载pom.xml中正确列出的jar时,这很有帮助,我无法找到为什么clean install with Update Snapshots/etc没有下载丢失的jar

      <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">
            <modelVersion>4.0.0</modelVersion>
            <groupId>hani.reservationVol</groupId>
            <artifactId>reservationVol</artifactId>
            <packaging>jar</packaging>
            <version>1.0-SNAPSHOT</version>
            <name>reservationVol</name>
            <dependencies>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>5.1.39</version>
                    <scope>compile</scope>
                </dependency>
                
                 <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-core</artifactId>
                    <version>5.1.0.Final</version>
                </dependency>
                
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-entitymanager</artifactId>
                    <version>5.1.0.Final</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-context</artifactId>
                    <version>4.2.6.RELEASE</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-orm</artifactId>
                    <version>4.2.6.RELEASE</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-dbcp2</artifactId>
                    <version>2.1.1</version>
                </dependency>
                
                <dependency>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                    <version>4.12</version>
                    <scope>test</scope>
                </dependency>
               
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-test</artifactId>
                    <version>4.2.5.RELEASE</version>
                </dependency>
            </dependencies>
        
            <build>
              <plugins>
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-compiler-plugin</artifactId>
                  <version>3.3</version>
                  <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                  </configuration>
                </plugin>
              </plugins>
            </build>
            
        </project>
    
    <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">
        <modelVersion>4.0.0</modelVersion>
        <groupId>formation.addstones</groupId>
        <artifactId>reservationVolSpring</artifactId>
        <packaging>war</packaging>
        <version>1.0-SNAPSHOT</version>
        <name>reservationVolSpring</name>
        <dependencies>
            <dependency>
                    <groupId>hani.reservationVol</groupId>
                    <artifactId>reservationVol</artifactId>
                    <version>1.0-SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>2.7.5</version>
            </dependency>
            <dependency>
                <groupId>jstl</groupId>
                <artifactId>jstl</artifactId>
                <version>1.2</version>
            </dependency>
            <dependency>
                <groupId>javax.servlet.jsp</groupId>
                <artifactId>jsp-api</artifactId>
                <version>2.2</version>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.1.0</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>4.2.6.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>4.2.6.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>1.0.0.GA</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>4.3.2.Final</version>
            </dependency>
        </dependencies>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.5.1</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </project>