标签: spring-boot-maven-plugin

STS(Spring Tool Suite)中没有用于将表转换为实体的Spring boot jpa工具

在这里,我在 Spring 工具套件中使用 Spring Boot。我想将 Oracle 数据库表转换为 JPA 类实体。但是我在 project_folder ->jpa 工具中没有得到任何 JPA 工具。我必须做什么,请您提出更好的解决方案。谢谢

jpa spring-boot-maven-plugin

7
推荐指数
1
解决办法
1万
查看次数

对于模块化项目,从 IntelliJ IDEA 运行 SpringBoot 应用程序失败

我的项目是一个SpringBoot应用程序,其中包含一个java模块。该模块没有open任何包。

模块信息.java

module my.somewhere
{ 
    requires spring.core;
    requires spring.context;
    requires spring.boot;
    // and so on
}
Run Code Online (Sandbox Code Playgroud)

从命令行调用时,应用程序按预期运行mvn clean spring-boot:run

但是当我尝试从 SpringBootApplication 的 main 方法启动它时,控制台中出现以下错误:(java.lang.IllegalAccessException: module my.somewhere does not open my.somewhere.abc to module spring.core请参阅下面的详细堆栈)。

由于其反射操作,向 Spring 开放一些东西看起来很合理,但我想知道为什么 Maven 能够毫无问题地运行它。

请帮助我了解如何使应用程序以类似的方式Maven 3.6.1运行IntelliJ IDEA 2019.3


详细堆栈:

org.springframework.cglib.core.CodeGenerationException: java.lang.IllegalAccessException-->module my.somewhere does not open my.somewhere.abc to module spring.core
    at spring.core@5.2.4.RELEASE/org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:514) ~[spring-core-5.2.4.RELEASE.jar:na]
    at spring.core@5.2.4.RELEASE/org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:363) ~[spring-core-5.2.4.RELEASE.jar:na]
    at spring.core@5.2.4.RELEASE/org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:582) ~[spring-core-5.2.4.RELEASE.jar:na]
    at spring.core@5.2.4.RELEASE/org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:110) ~[spring-core-5.2.4.RELEASE.jar:na]
    at spring.core@5.2.4.RELEASE/org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:108) ~[spring-core-5.2.4.RELEASE.jar:na]
    at spring.core@5.2.4.RELEASE/org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54) …
Run Code Online (Sandbox Code Playgroud)

intellij-idea maven-3 spring-boot spring-boot-maven-plugin java-11

7
推荐指数
1
解决办法
1790
查看次数

在 Spring Boot Maven 插件创建的 Docker 镜像中安装包

我的 Spring Boot 项目包含 Spring Boot Maven 插件,我使用它通过运行mvn spring-boot:build-image.

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>build-image</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

将此映像部署到 Docker 堆栈时,我需要使用该curl命令运行运行状况检查,但不幸的curl是默认构建包未安装该命令。

是否可以进一步调整图像构建过程,以便curl安装到图像中?我找不到必要的信息

docker spring-boot spring-boot-maven-plugin

7
推荐指数
1
解决办法
2997
查看次数

Spring Cloud 配置客户端应用程序无法启动并出现 java.lang.NoClassDefFoundError

我对 Spring Cloud 配置客户端应用程序有一些问题。当我在 pom.xml 中使用 spring-boot-starter-parent 作为父级(如下所示)时,我的应用程序工作正常并且能够从 Spring Cloud 配置服务器获取属性。

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    **<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.3</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>**
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>2020.0.1</spring-cloud.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin> …
Run Code Online (Sandbox Code Playgroud)

java spring-boot spring-boot-maven-plugin spring-cloud-config spring-cloud-config-server

7
推荐指数
0
解决办法
982
查看次数

使用 paketo 进行 Spring-Boot docker 构建在 Bitbucket 管道上失败

我的 spring-boot projekts 使用 spring-boot-maven-plugin 及其构建映像目标在 bitbucket.org 上构建其 docker 映像。在管道上,我们总是收到以下 Maven 错误:

Docker API call to 'localhost:2375/v1.24/containers/create' failed with status code 403 "Forbidden"
Run Code Online (Sandbox Code Playgroud)

在docker日志中我发现了以下内容

time="2021-03-25T11:30:59Z" level=info msg="Container create request." ArgsEscaped=false AttachStderr=false AttachStdin=false AttachStdout=false ExposedPorts="map[]" Healthcheck="<nil>" Labels="map[author:spring-boot]" MacAddress= NetworkDisabled=false OnBuild="[]" OpenStdin=false StdinOnce=false StopSignal= StopTimeout="<nil>" Tty=false plugin=pipelines

time="2021-03-25T11:30:59Z" level=info msg="Container create request." AutoRemove=false BlkioDeviceReadBps="[]" BlkioDeviceReadIOps="[]" BlkioDeviceWriteBps="[]" BlkioDeviceWriteIOps="[]" BlkioWeight=0 BlkioWeightDevice="[]" CPUCount=0 CPUPercent=0 CPUPeriod=0 CPUQuota=0 CPURealtimePeriod=0 CPURealtimeRuntime=0 CPUShares=0 CapAdd="[]" CapDrop="[]" Capabilities="[]" Cgroup= CgroupParent= ConsoleSize="[0 0]" ContainerIDFile= CpusetCpus= CpusetMems= DNS="[]" DNSOptions="[]" DNSSearch="[]" DeviceCgroupRules="[]" Devices="[]" ExtraHosts="[]" …
Run Code Online (Sandbox Code Playgroud)

buildpack spring-boot spring-boot-maven-plugin bitbucket-pipelines paketo

7
推荐指数
0
解决办法
590
查看次数

没有依赖项的 Spring Boot 可执行 Jar 文件

在没有依赖项的情况下构建 spring boot jar 文件的最简单方法是什么?基本上我应该能够将依赖项 jar 文件保存在单独的文件夹中。

目前我正在使用 spring boot maven 插件,但是,它会创建一个包含所有依赖项的 Fat jar 文件。

spring-boot spring-boot-maven-plugin

6
推荐指数
1
解决办法
8300
查看次数

使用 spring boot maven 插件重新打包后,JAR 文件中缺少资源

我的应用程序使用资源文件夹中的一些附加文件。当我使用 Maven 进行常规构建并将我的应用程序打包到 JAR 中时,如果我解压缩此存档,我可以看到所有资源。

但是当我创建 docker 映像时,我使用 spring-boot-maven-plugin 使我的 JAR 存档可执行。由于某种原因,我的资源没有添加到新的重新打包的 JAR 中。此外,我什至无法解压缩它,因为它已损坏。

这是我在 pom.xml 中设置重新打包目标的方法:

<id>prod</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>1.5.3.RELEASE</version>
                    <configuration>
                        <mainClass>ApplicationName</mainClass>
                        <executable>true</executable>
                        <arguments>
                            <argument>--spring.profiles.active=prod</argument>
                        </arguments>
                        <!--<addResources>true</addResources>-->
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                            <configuration>
                                <!--<includeSystemScope>true</includeSystemScope>-->
                                <!--<layout>JAR</layout>-->
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
Run Code Online (Sandbox Code Playgroud)

我想补充一点,当我在 docker 中运行我的映像时,它工作正常,但缺少所有所需的资源

有人遇到同样的问题吗?或者您可以建议如何修复它。

maven docker spring-boot spring-boot-maven-plugin docker-maven-plugin

6
推荐指数
0
解决办法
1250
查看次数

Spring Boot多模块maven项目重新打包失败

我目前正在学习 John Thompson 的 Spring 框架初学者到大师课程。我按照他的一步步程序在 Spring Boot 上为 Spring Pet Clinic 创建多模块 Maven 项目。当我单击根模块上的包时,它显示重新打包失败,无法找到主类。

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        <executions>
            <execution>
                <goals>
                    <goal>repackage</goal>
                </goals>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </execution>
        </executions>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

[错误] 无法在项目 pet-clinic-data 上执行目标 org.springframework.boot:spring-boot-maven-plugin:2.1.6.RELEASE:repackage(重新打包):目标 org.springframework.boot:spring 的执行重新打包-boot-maven-plugin:2.1.6.RELEASE:重新打包失败:无法找到主类 -> [帮助 1]

java spring-mvc multi-module spring-boot spring-boot-maven-plugin

6
推荐指数
4
解决办法
6491
查看次数

Intellij IDEA 中 spring 关键字的红色

我无法解决IntelliJ IDEA中以红色突出显示的Spring Boot leyword问题。我在IntelliJ中使用了无效缓存和同步选项,但这并没有解决问题。

错误的图像

pom.xml

悬停错误图像

POM.xml

<?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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.6.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>12</java.version>
    </properties>

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

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

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

</project>
Run Code Online (Sandbox Code Playgroud)

java intellij-idea spring-boot-maven-plugin

6
推荐指数
1
解决办法
9909
查看次数

将 Spring Boot 配置文件与命令行参数一起使用

我对如何在 Spring Boot 应用程序中使用配置文件感到困惑。

假设我在pom.xml文件中定义了配置文件,以下是我找到的不同方法。

mvnw -Pdev

mvnw spring-boot:run -Dspring-boot.run.profiles=dev

mvnw spring-boot:run -Dspring.profiles.active=dev

mvnw spring-boot:run --spring.profiles.active=dev
Run Code Online (Sandbox Code Playgroud)

1/ 它们之间有什么区别吗?

2/ 最好的使用方法是什么?

maven maven-profiles spring-boot spring-boot-maven-plugin

6
推荐指数
1
解决办法
1万
查看次数