title: How to create Micronaut's fat-jar without shadow plugin?
body: <p>What started as a roadblock to setup a new Micronaut project with corporate repo, is now more about curiosity of how Embedded server is bootstrapped. I have a <a href="https://docs.micronaut.io/latest/guide/index.html" rel="nofollow noreferrer">Micronaut</a> CLI generated project with <code>com.github.johnrengelman.shadow</code> <strong>gradle</strong> plugin which works fine when I run the jar using-</p>
  <pre><code>$ java -Dmicronaut.environments=E1 -jar build/appBundle/app.jar
  </code></pre>
  <p><strong>build.gradle</strong>-</p>
  <pre><code>plugins {
    id &quot;com.github.johnrengelman.shadow&quot; version &quot;5.0.0&quot;
  }
  
  ...
  
  shadowJar {
      mergeServiceFiles()
  }
  </code></pre>
  <p>When I replace <code>shadow</code> plugin/task with <code>jar</code> task and <code>java</code> plugin, then I am able to create an executable fat-jar , but it fails with following error-</p>
  <pre><code>$ java -Dmicronaut.environments=E1 -jar build/appBundle/app.jar
  16:12:22.662 [main] INFO  i.m.context.env.DefaultEnvironment - Established active environments: [E1]
  16:12:22.863 [main] INFO  io.micronaut.runtime.Micronaut - No embedded container found. Running as CLI application
  </code></pre>
  <p><strong>build.gradle</strong>-</p>
  <pre><code>plugins {
    id &quot;java&quot;
  }
  
  ...
  
  jar {
    manifest {
      attributes &quot;Main-Class&quot;: &quot;foo.bar.someclass&quot;
    }
  
    from {
      configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
      configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    }
  }
  </code></pre>
  <ol>
  <li>What I would like to understand is how the embedded server bean is getting injected with shadow plugin but not otherwise?</li>
  <li>How to create a <code>fat-jar</code> with embedded Netty server and without using <code>com.github.johnrengelman.shadow</code> gradle plugin?</li>
  </ol>