title: SpringBoot: Unable to find a single main class from the following candidates
body: <p>I've generated a Spring Boot web application using Spring Initializer, embedded Tomcat, Thymeleaf template engine.Technologies used:
  Spring Boot 1.4.2.RELEASE, Spring 4.3.4.RELEASE, Thymeleaf 2.1.5.RELEASE, Tomcat Embed 8.5.6, Maven 3, Java 8</p>
  
  <p>I have an SpringBoot app. with these 2 classes:</p>
  
  <pre><code>@Profile("!war")
  @SpringBootApplication
  @Import({SecurityConfig.class ,PersistenceConfig.class, ServiceConfig.class})
  public class BookApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(BookApplication.class, args);
      }
  }
  
  @Profile("war")
  @Import({SecurityConfig.class ,PersistenceConfig.class})
  @SpringBootApplication
  public class BookApplicationWar extends SpringBootServletInitializer {
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
          return application.sources(BookApplicationWar.class);
      }
  
      public static void main(String[] args) throws Exception {
          SpringApplication.run(BookApplicationWar.class, args);
      }
  
  }
  </code></pre>
  
  <p>I generate the war with this command</p>
  
  <pre><code> mvn clean package -DskipTests -Dspring.profiles.active=pebloc,war -DAPP-KEY=pebloc
  </code></pre>
  
  <p>But I got this error:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.2.RELEASE:repackage (default) on project book: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.2.RELEASE:repackage failed: Unable to find a single main class from the following candidates [com.tdk.BookApplication, com.tdk.BookApplicationWar] -&gt; [Help 1]
  </code></pre>