Maven在构建时缺少库

在我构建(全新安装)项目时,将spring迁移到spring boot应用程序中。在构建jar中不包含支持库项目

父母pom

<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>
    <parent>
        <groupId>X</groupId>
        <artifactId>X</artifactId>
        <version>1.0</version>
    </parent>
    <artifactId>Administration</artifactId>
    <packaging>pom</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.compiler.version>1.8</java.compiler.version>
        <maven-jar-plugin.version>2.6</maven-jar-plugin.version>
        <maven-surefire-plugin>2.19.1</maven-surefire-plugin>
        <maven-assembly-plugin.version>2.5.5</maven-assembly-plugin.version>
        <!-- <spring.version>4.1.7.RELEASE</spring.version> -->
        <springframework.boot.version>2.1.7.RELEASE</springframework.boot.version>
        <junit.version>4.11</junit.version>
        <maven-war-plugin.version>2.6</maven-war-plugin.version>
        <maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
        <tomcat.version>8.5.12</tomcat.version>
        <tomcat.8.0.version>8.0.50</tomcat.8.0.version>
        <log4j.version>1.2.16</log4j.version>
        <httpclient.version>4.5.3</httpclient.version>
        <jackson.version>2.9.5</jackson.version>
        <powermock.version>1.7.4</powermock.version>
        <junit.version>4.11</junit.version>
        <mockito.version>1.10.16</mockito.version>
        <slf4j.version>1.7.5</slf4j.version>
        <json.version>20080701</json.version>
        <dom4j.version>1.6.1</dom4j.version>
        <implementation.version>7.0.0.0</implementation.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>${java.compiler.version}</source>
                    <target>${java.compiler.version}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven-jar-plugin.version}</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Implementation-Version>${implementation.version}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin}</version>
                <configuration>
                    <argLine>-Xmx512m -XX:MaxPermSize=256m</argLine>
                </configuration>
            </plugin>

        </plugins>

    </build>
    <modules>
        <module>MyService</module>

    </modules>
</project>

MyService pom

<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>
    <parent>
        <groupId>X</groupId>
        <artifactId>Administration</artifactId>
        <version>1.0</version>
    </parent>
    <artifactId>myservice</artifactId>
    <packaging>jar</packaging>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${springframework.boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>X</groupId>
            <artifactId>Client</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>X1</groupId>
            <artifactId>comon</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>X2</groupId>
            <artifactId>xx</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>
        <!-- Spring boot dependencies -->
        <!-- <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>-->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
        </dependency> 
        <dependency>
        <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>

        </dependency>
        <dependency>        
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

 <build>
        <pluginmanagement>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${maven-war-plugin.version}</version>
                    <configuration>
                        <warSourceDirectory>src/main/webapp</warSourceDirectory>
                        <warName>MyService</warName>
                        <failOnmissingWebXml>false</failOnmissingWebXml>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-eclipse-plugin</artifactId>
                    <version>${maven-eclipse-plugin.version}</version>
                    <configuration>
                        <wtpversion>2.0</wtpversion>
                        <jeeversion>6.0</jeeversion>
                    </configuration>
                </plugin>
            </plugins>
        </pluginmanagement>
    </build>
<project>

我希望将整个构建更改为以下

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

仅build.build文件大小40kb

时没有发现错误

manifest.mf

Manifest-Version: 1.0
Implementation-Version: 7.0.0.0
Archiver-Version: Plexus Archiver
Built-By: Administrator
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_202

我在网址下面关注

Missing Maven dependencies in Eclipse project

仍然保持不变。如何解决此问题?

a665362 回答:Maven在构建时缺少库

我已经像打击一样修改了spring-boot-maven-plugin

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>  
              <executions>
                 <execution>
                     <goals>
                         <goal>repackage</goal>
                     </goals>
                 </execution>
             </executions>         
            <configuration>    
                <mainClass>com.data.conf.MyServiceMain</mainClass>
            </configuration>
        </plugin>
    </plugins>
</build>

现在一切都很好。

本文链接:https://www.f2er.com/3147548.html

大家都在问