문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top