File tree Expand file tree Collapse file tree
deployment-jetty/src/main/java/dev/getelements/elements/deployment/jetty/loader
sdk-element-standard-kt/src/main/resources/archetype-resources/element Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313import org .eclipse .jetty .ee10 .servlet .ServletContextHandler ;
1414import org .eclipse .jetty .ee10 .servlet .ServletHolder ;
1515import org .eclipse .jetty .server .Handler .Sequence ;
16+ import org .glassfish .jersey .server .ServerProperties ;
1617import org .glassfish .jersey .servlet .ServletContainer ;
1718import org .slf4j .Logger ;
1819import org .slf4j .LoggerFactory ;
2829import static dev .getelements .elements .sdk .model .Constants .APP_OUTSIDE_URL ;
2930import static org .glassfish .jersey .CommonProperties .MOXY_JSON_FEATURE_DISABLE ;
3031import static org .glassfish .jersey .server .ResourceConfig .forApplication ;
32+ import static org .glassfish .jersey .server .ServerProperties .FEATURE_AUTO_DISCOVERY_DISABLE ;
3133
3234/**
3335 * Searches an {@link Element} for a service of type {@link Application} and loads it into the application container
@@ -109,6 +111,13 @@ private JettyDeploymentRecord deploy(final PendingDeployment pending,
109111 config .property (MOXY_JSON_FEATURE_DISABLE , true );
110112 }
111113
114+ if (!config .hasProperty (FEATURE_AUTO_DISCOVERY_DISABLE )) {
115+ // We know this interferes with Kotlin based elements or any Element which tries to include its own
116+ // jackson provider. So we disable support for this by default. Even in non-kotlin projects this should
117+ // be avoided because we end up polluting the Element's classpath with services it may not want to use.
118+ config .property (FEATURE_AUTO_DISCOVERY_DISABLE , true );
119+ }
120+
112121 final var container = new ServletContainer (config );
113122 final var holder = new ServletHolder (container );
114123
Original file line number Diff line number Diff line change 185185 <prependGroupId >true</prependGroupId >
186186 </configuration >
187187 </execution >
188+ <!-- Kotlin Specific. The API must have the Kotlin libraries included -->
189+ <execution >
190+ <id >elm-copy-kotlin-stdlib-api</id >
191+ <phase >prepare-package</phase >
192+ <goals >
193+ <goal >copy-dependencies</goal >
194+ </goals >
195+ <configuration >
196+ <outputDirectory >${elm.element.dir} /api</outputDirectory >
197+ <includeGroupIds >org.jetbrains.kotlin</includeGroupIds >
198+ <prependGroupId >true</prependGroupId >
199+ </configuration >
200+ </execution >
188201 </executions >
189202 </plugin >
190203
You can’t perform that action at this time.
0 commit comments