|
114 | 114 | </plugins> |
115 | 115 | </build> |
116 | 116 |
|
| 117 | + <profiles> |
| 118 | + <profile> |
| 119 | + <id>standalone</id> |
| 120 | + <build> |
| 121 | + <plugins> |
| 122 | + <plugin> |
| 123 | + <groupId>org.graalvm.buildtools</groupId> |
| 124 | + <artifactId>native-maven-plugin</artifactId> |
| 125 | + <version>0.10.3</version> |
| 126 | + <configuration> |
| 127 | + <imageName>standalone-app</imageName> |
| 128 | + <mainClass>example.micronaut.Application</mainClass> |
| 129 | + </configuration> |
| 130 | + </plugin> |
| 131 | + </plugins> |
| 132 | + </build> |
| 133 | + </profile> |
| 134 | + <profile> |
| 135 | + <id>base-layer</id> |
| 136 | + <build> |
| 137 | + <directory>${project.basedir}/base-layer-target</directory> |
| 138 | + <plugins> |
| 139 | + <plugin> |
| 140 | + <groupId>org.graalvm.buildtools</groupId> |
| 141 | + <artifactId>native-maven-plugin</artifactId> |
| 142 | + <version>0.10.3</version> |
| 143 | + <configuration> |
| 144 | + <imageName>libmicronautbaselayer</imageName> |
| 145 | + <mainClass>.</mainClass> |
| 146 | + <buildArgs> |
| 147 | + <buildArg>-H:+UnlockExperimentalVMOptions</buildArg> |
| 148 | + <buildArg>-H:LayerCreate=base-layer.nil,module=java.base,package=io.micronaut.*,package=io.netty.*,package=jakarta.*,package=com.fasterxml.jackson.*,package=org.slf4j.*,package=reactor.*,package=org.reactivestreams.*</buildArg> |
| 149 | + <buildArg>-H:ApplicationLayerOnlySingletons=io.micronaut.core.io.service.ServiceScanner$StaticServiceDefinitions</buildArg> |
| 150 | + <buildArg>-H:ApplicationLayerInitializedClasses=io.micronaut.inject.annotation.AnnotationMetadataSupport</buildArg> |
| 151 | + <buildArg>-H:ApplicationLayerInitializedClasses=io.micronaut.core.io.service.MicronautMetaServiceLoaderUtils</buildArg> |
| 152 | + <buildArg>-H:-UnlockExperimentalVMOptions</buildArg> |
| 153 | + </buildArgs> |
| 154 | + </configuration> |
| 155 | + </plugin> |
| 156 | + <plugin> |
| 157 | + <groupId>org.apache.maven.plugins</groupId> |
| 158 | + <artifactId>maven-compiler-plugin</artifactId> |
| 159 | + <configuration> |
| 160 | + <excludes> |
| 161 | + <exclude>**/example/micronaut/**</exclude> |
| 162 | + </excludes> |
| 163 | + <testExcludes> |
| 164 | + <exclude>**/example/micronaut/**</exclude> |
| 165 | + </testExcludes> |
| 166 | + </configuration> |
| 167 | + </plugin> |
| 168 | + <plugin> |
| 169 | + <groupId>org.apache.maven.plugins</groupId> |
| 170 | + <artifactId>maven-install-plugin</artifactId> |
| 171 | + <executions> |
| 172 | + <execution> |
| 173 | + <phase>install</phase> |
| 174 | + <goals> |
| 175 | + <goal>install-file</goal> |
| 176 | + </goals> |
| 177 | + <configuration> |
| 178 | + <groupId>${project.groupId}</groupId> |
| 179 | + <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file> |
| 180 | + <artifactId>micronaut-base-layer</artifactId> |
| 181 | + <packaging>jar</packaging> |
| 182 | + </configuration> |
| 183 | + </execution> |
| 184 | + </executions> |
| 185 | + </plugin> |
| 186 | + </plugins> |
| 187 | + </build> |
| 188 | + </profile> |
| 189 | + <profile> |
| 190 | + <id>app-layer</id> |
| 191 | + <dependencies> |
| 192 | + <dependency> |
| 193 | + <groupId>${project.groupId}</groupId> |
| 194 | + <artifactId>micronaut-base-layer</artifactId> |
| 195 | + <version>${project.version}</version> |
| 196 | + </dependency> |
| 197 | + </dependencies> |
| 198 | + <build> |
| 199 | + <directory>${project.basedir}/app-layer-target</directory> |
| 200 | + <plugins> |
| 201 | + <plugin> |
| 202 | + <groupId>org.graalvm.buildtools</groupId> |
| 203 | + <artifactId>native-maven-plugin</artifactId> |
| 204 | + <version>0.10.3</version> |
| 205 | + <configuration> |
| 206 | + <imageName>layered-app</imageName> |
| 207 | + <mainClass>example.micronaut.Application</mainClass> |
| 208 | + <buildArgs> |
| 209 | + <buildArg>-H:+UnlockExperimentalVMOptions</buildArg> |
| 210 | + <buildArg>-H:LayerUse=base-layer-target/base-layer.nil</buildArg> |
| 211 | + <buildArg>-H:LinkerRPath=$ORIGIN</buildArg> |
| 212 | + <buildArg>-H:-UnlockExperimentalVMOptions</buildArg> |
| 213 | + </buildArgs> |
| 214 | + </configuration> |
| 215 | + </plugin> |
| 216 | + <plugin> |
| 217 | + <groupId>org.apache.maven.plugins</groupId> |
| 218 | + <artifactId>maven-resources-plugin</artifactId> |
| 219 | + <version>3.3.1</version> |
| 220 | + <executions> |
| 221 | + <execution> |
| 222 | + <id>copy-base-layer</id> |
| 223 | + <phase>prepare-package</phase> |
| 224 | + <goals> |
| 225 | + <goal>copy-resources</goal> |
| 226 | + </goals> |
| 227 | + <configuration> |
| 228 | + <outputDirectory>${project.build.directory}</outputDirectory> |
| 229 | + <resources> |
| 230 | + <resource> |
| 231 | + <directory>base-layer-target</directory> |
| 232 | + <includes> |
| 233 | + <include>libmicronautbaselayer.so</include> |
| 234 | + </includes> |
| 235 | + <filtering>false</filtering> |
| 236 | + </resource> |
| 237 | + </resources> |
| 238 | + </configuration> |
| 239 | + </execution> |
| 240 | + </executions> |
| 241 | + </plugin> |
| 242 | + </plugins> |
| 243 | + </build> |
| 244 | + </profile> |
| 245 | + </profiles> |
| 246 | + |
117 | 247 | </project> |
0 commit comments