Spring Boot Maven Plugin

user3600073

I have two classes with main method and one loads the security configuration and the other does not. In order to create two artifacts - secure and non secure jars, I am doing something like the following :

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>1</id>
                        <configuration>

                            <mainClass>a.b.c.Secured</mainClass>
                            <finalName>secured</finalName>
                            <classifier>secured</classifier>
                        </configuration>
                    </execution>
                    <execution>
                        <id>2</id>
                        <configuration>

                            <mainClass>a.b.c.NonSecured</mainClass>
                            <finalName>non-secured</finalName>
                            <classifier>nonSecured</classifier>
                        </configuration>
                    </execution>
                </executions>

            </plugin>

        </plugins>

And I am seeing the exception -

java.lang.IllegalStateException: Unable to find a single main class from the following candidates.

Can you please let me know, if there is some thing wrong with the above configuration? I may be able to use maven profiles to create different artifacts. However, I wanted to understand the problem with the above configuration. Any help will be greatly appreciated.

Dave Syer

I think both those configurations are active at the same time (otherwise how do you tell maven which one to use?). You could put them both in Maven profiles.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Spring Boot Maven Plugin

From Dev

ProGuard + Spring Boot + Maven Plugin

From Dev

Spring boot and maven exec plugin issue

From Dev

spring boot maven plugin stop goal

From Dev

Spring Boot Maven Plugin - No BOOT-INF directory

From Java

Generate Code Coverage with JaCoCo and spring-boot-maven-plugin

From Dev

Spring Boot With Maven Shade Plugin - Controllers not mapped (404 Error)

From Dev

How to generate executable scripts using spring boot maven plugin

From Dev

Spring boot core dependencies seen as unused by maven-dependency-plugin

From Dev

How can I configure Maven Liquibase plugin in Spring Boot?

From Dev

spring-boot-maven-plugin doesn't create fat jar

From Dev

Lombok doesn't work with spring-boot-maven-plugin

From Dev

Exclude Java Source using Spring Boot Maven Plugin at Build time

From Dev

execution default of spring-boot-maven-plugin repackage failed

From Dev

Spring boot maven plugin skips some classes from the jar

From Dev

Spring-boot-maven-plugin repackage goal error using nar-maven-plugin

From Dev

Maven Spring Boot Plugin : how to run spring boot from another project

From Java

Maven- No plugin found for prefix 'spring-boot' in the current project and in the plugin groups

From Java

Spring Boot fails to run maven-surefire-plugin ClassNotFoundException org.apache.maven.surefire.booter.ForkedBooter

From Dev

Spring DevTools not included in the fat jar packaged with spring-boot-maven-plugin

From Dev

Could not find goal '' in plugin org.springframework.boot:spring-boot-maven-plugin:1.1.4.RELEASE among available goals repackage

From Dev

Plugin org.springframework.boot:spring-boot-maven-plugin:1.3.0.BUILD-SNAPSHOT or one of its dependencies could not be resolved

From Dev

Could not find goal '' in plugin org.springframework.boot:spring-boot-maven-plugin:1.1.4.RELEASE among available goals repackage

From Dev

How to add Classpath attribute in manifest.mf when using spring boot maven plugin to build jar

From Dev

TypeNotPresentExceptionProxy error at integration-test with maven-failsafe-plugin spring-boot 1.4

From Dev

Spring Boot maven plugin cant find main class, Could not exec java

From Dev

How to run integration test of a spring-boot based application through maven-failsafe-plugin?

From Dev

Adding classpath to SpringBoot command line start when using maven-spring-boot-plugin

From Dev

Can I make an executable jar with "build-info" by "Spring Boot Maven Plugin"?

Related Related

  1. 1

    Spring Boot Maven Plugin

  2. 2

    ProGuard + Spring Boot + Maven Plugin

  3. 3

    Spring boot and maven exec plugin issue

  4. 4

    spring boot maven plugin stop goal

  5. 5

    Spring Boot Maven Plugin - No BOOT-INF directory

  6. 6

    Generate Code Coverage with JaCoCo and spring-boot-maven-plugin

  7. 7

    Spring Boot With Maven Shade Plugin - Controllers not mapped (404 Error)

  8. 8

    How to generate executable scripts using spring boot maven plugin

  9. 9

    Spring boot core dependencies seen as unused by maven-dependency-plugin

  10. 10

    How can I configure Maven Liquibase plugin in Spring Boot?

  11. 11

    spring-boot-maven-plugin doesn't create fat jar

  12. 12

    Lombok doesn't work with spring-boot-maven-plugin

  13. 13

    Exclude Java Source using Spring Boot Maven Plugin at Build time

  14. 14

    execution default of spring-boot-maven-plugin repackage failed

  15. 15

    Spring boot maven plugin skips some classes from the jar

  16. 16

    Spring-boot-maven-plugin repackage goal error using nar-maven-plugin

  17. 17

    Maven Spring Boot Plugin : how to run spring boot from another project

  18. 18

    Maven- No plugin found for prefix 'spring-boot' in the current project and in the plugin groups

  19. 19

    Spring Boot fails to run maven-surefire-plugin ClassNotFoundException org.apache.maven.surefire.booter.ForkedBooter

  20. 20

    Spring DevTools not included in the fat jar packaged with spring-boot-maven-plugin

  21. 21

    Could not find goal '' in plugin org.springframework.boot:spring-boot-maven-plugin:1.1.4.RELEASE among available goals repackage

  22. 22

    Plugin org.springframework.boot:spring-boot-maven-plugin:1.3.0.BUILD-SNAPSHOT or one of its dependencies could not be resolved

  23. 23

    Could not find goal '' in plugin org.springframework.boot:spring-boot-maven-plugin:1.1.4.RELEASE among available goals repackage

  24. 24

    How to add Classpath attribute in manifest.mf when using spring boot maven plugin to build jar

  25. 25

    TypeNotPresentExceptionProxy error at integration-test with maven-failsafe-plugin spring-boot 1.4

  26. 26

    Spring Boot maven plugin cant find main class, Could not exec java

  27. 27

    How to run integration test of a spring-boot based application through maven-failsafe-plugin?

  28. 28

    Adding classpath to SpringBoot command line start when using maven-spring-boot-plugin

  29. 29

    Can I make an executable jar with "build-info" by "Spring Boot Maven Plugin"?

HotTag

Archive