NutzCN Logo
问答 maven 父模块使用dependencyManagement,子模块只需给出groupId和artifactId,不用给version
发布于 2646天前 作者 Gaea-IT 4550 次浏览 复制 上一个帖子 下一个帖子
标签:

maven 父模块使用dependencyManagement,子模块只需给出groupId和artifactId,不用给version
但是我项目的子模块中不给version就报错,给version就不报错

9 回复

Project build error: 'dependencies.dependency.version' for commons-httpclient:commons-httpclient:jar is missing.
我本地仓库是有jar的

parent里面没有声明这个库?

parent 里面肯定申明了 啊

这个是parent

<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>com.jimistore.util</groupId>
	<artifactId>common-util-parent</artifactId>
	<packaging>pom</packaging>

	<modules>
		<module>format-util</module>
		<module>reflex-util</module>
		<module>valid-util</module>
		<module>io-util</module>
		<module>common-util</module>
	</modules>

	<parent>
		<groupId>com.jimistore.boot</groupId>
		<artifactId>nemo-boot-starter-parent</artifactId>
		<version>1.0.4-RELEASE</version>
	</parent>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<java.version>1.7</java.version>
		<format.util.version>1.0.0</format.util.version>
		<reflex.util.version>1.0.0</reflex.util.version>
		<valid.util.version>1.0.0</valid.util.version>
		<io.util.version>1.0.0</io.util.version>
		<common.util.version>1.0.0</common.util.version>
		<poi.version>3.10.1</poi.version>
	</properties>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>com.jimistore.util</groupId>
				<artifactId>format-util</artifactId>
				<version>${format.util.version}</version>
			</dependency>
			<dependency>
				<groupId>com.jimistore.util</groupId>
				<artifactId>reflex-util</artifactId>
				<version>${reflex.util.version}</version>
			</dependency>
			<dependency>
				<groupId>com.jimistore.util</groupId>
				<artifactId>valid-util</artifactId>
				<version>${valid.util.version}</version>
			</dependency>
			<dependency>
				<groupId>com.jimistore.util</groupId>
				<artifactId>io-util</artifactId>
				<version>${io.util.version}</version>
			</dependency>
			<dependency>
				<groupId>com.jimistore.util</groupId>
				<artifactId>common-util</artifactId>
				<version>${common.util.version}</version>
			</dependency>
			<!-- http-client -->
			<dependency>
				<groupId>commons-httpclient</groupId>
				<artifactId>commons-httpclient</artifactId>
				<version>3.1</version>
			</dependency>
			<!--poi -->
			<dependency>
				<groupId>org.apache.poi</groupId>
				<artifactId>poi</artifactId>
				<version>${poi.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.poi</groupId>
				<artifactId>poi-ooxml</artifactId>
				<version>${poi.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.poi</groupId>
				<artifactId>poi-ooxml-schemas</artifactId>
				<version>${poi.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.poi</groupId>
				<artifactId>poi-scratchpad</artifactId>
				<version>${poi.version}</version>
			</dependency>
			<!--commons-beanutils -->
			<dependency>
				<groupId>commons-beanutils</groupId>
				<artifactId>commons-beanutils</artifactId>
			</dependency>
		</dependencies>
	</dependencyManagement>
</project>

这个是子模块

<?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>

	<artifactId>io-util</artifactId>
	<packaging>jar</packaging>

	<name>io-util</name>
	<description></description>

	<parent>
		<groupId>com.jimistore.util</groupId>
		<artifactId>common-util-parent</artifactId>
		<version>1.0.1-RELEASE</version>
	</parent>

	<properties>
		<poi.version>3.10.1</poi.version>
	</properties>
	
	<dependencies>
		<!-- http-client -->
		<dependency>
			<groupId>commons-httpclient</groupId>
			<artifactId>commons-httpclient</artifactId>
			<version>3.1</version>
		</dependency>
		<!--poi-->
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi-ooxml</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi-ooxml-schemas</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi-scratchpad</artifactId>
		</dependency>
		<!--commons-beanutils-->
		<dependency>
			<groupId>commons-beanutils</groupId>
			<artifactId>commons-beanutils</artifactId>
		</dependency>
	</dependencies>


</project>

commons-beanutils 并没有写version

这个我也不清楚为什么父模块和子模块都没有写而且还没有报错

好了,解决了,parent的版本号被人删了

添加回复
请先登陆
回到顶部