pom.xml Depending on the error report, the problem of missing artifact XXX is solved

pom.xml Depending on the error report, the problem of missing artifact XXX is solved

Possible causes pom.xml The dependency configuration format specifies that you manually download the corresponding jar and then install it to the local repository pom.xml After modification

Eclipse imports or creates a new Maven project, pom.xml An error is reported in the configuration file, missing artifact XXX jar. The problem is that the jar package is not found in the specified warehouse after Maven is started.

Possible causes

    there is no such jar package in the central warehouse or local warehouse; some jar packages are charged (for example, Oracle) ojdbc.jar In fact, there is no such resource in Maven Central Library, so it cannot be loaded; pom.xml Configuration items do not match.

pom.xml Dependency configuration format description

// pom.xml
<dependencies>
		<dependency>
			<groupId>Package1</groupId>
			<artifactId>jarName</artifactId>
			<version>versionInJar</version>
		</dependency>
		<dependency>
			<groupId>Package2</groupId>
			<artifactId>jarName2</artifactId>
			<version>1.0.0</version>
		</dependency>
		......
</dependencies>

Groupid: the relative path of the dependent jar package. The parent-child directory is marked with “.” (example: package.packageNext ); artifactid: dependent jar package name; version: dependent jar package version.

Manually download the corresponding jar, and then install it to the local warehouse

    download the corresponding version of the jar package; open the CMD, preferably in the path to be installed (the installation command is more convenient, directly in the address bar of the path to be installed, enter CMD to quickly open the command window); install here. Take Ojdbc14 as an example, after opening CMD, enter the command as follows:

    mvn install:install-file -Dpackaging=jar -DgroupId= com.oracle -DartifactId=ojdbc14 -Dversion=11.2.0.3.0 -Dfile=ojdbc14-11.2.0.3.0.jar -DgeneratePom=true

    Command explanation:
    install: compile and package the project to the local warehouse;
    install file: install file;
    – dgroupid= com.oracle : Specifies that the groupid of the current package is com.oracle ;
    – dartifactid = Ojdbc14: Specifies that the current artifact ID is Ojdbc14;
    – dversion = 11.2.0.3.0: Specifies that the current package version is 11.2.0.3.0;
    – dversion = 11.2.0.3.0 -Dfile = D: ojdbc14-11.2.0.3.0.jar: Specifies the file location of the package to be typed (the reason why you want to open CMD in the path before is to avoid entering an excessively long path);
    – dgeneratepom = true: whether to generate a POM file.

      open the Maven project in eclipse, right-click Maven – & gt; update or click open pom.xml File, right-click Maven – & gt; update for project.

    pom.xml After modification

    <dependency>
    			<groupId>com.oracle</groupId>
    			<artifactId>ojdbc14</artifactId>
    			<version>11.2.0.3.0</version>
    </dependency>
    

Read More: