Skip to content

Commit

Permalink
Tried requiresUnpack - no success
Browse files Browse the repository at this point in the history
  • Loading branch information
fabapp2 committed Sep 24, 2023
1 parent c9ff126 commit 6bd898c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 6 deletions.
38 changes: 34 additions & 4 deletions sbm-support-rewrite-integration-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,41 @@
</execution>
</executions>
<configuration>
<layers>
<enabled>false</enabled>
</layers>
<requiresUnpack>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-wagon</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-connector-basic</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-embedder</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-cipher</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
</dependency>
</requiresUnpack>
<!-- <layers>-->
<!-- <enabled>false</enabled>-->
<!-- </layers>-->
<mainClass>com.acme.example.SpringBoot3Upgrade</mainClass>
<layout>ZIP</layout>
<!-- <layout>JAR</layout>-->
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
logging.level.root=warn
logging.level.org.springframework.sbm=debug
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.springframework.sbm.parsers;

import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.apache.maven.graph.GraphBuilder;
import org.codehaus.plexus.*;
import org.codehaus.plexus.classworlds.ClassWorld;
Expand All @@ -26,6 +27,7 @@

import java.net.URL;

@Slf4j
class MavenPlexusContainer {

private PlexusContainer plexusContainer;
Expand Down Expand Up @@ -57,8 +59,8 @@ public PlexusContainer create() {
ClassLoader parent = null;
boolean isContainerAutoWiring = false;
String containerClassPathScanning = PlexusConstants.SCANNING_ON;
String containerComponentVisibility = null; //PlexusConstants.GLOBAL_VISIBILITY;
URL overridingComponentsXml = null; //getClass().getClassLoader().getResource("META-INF/**/components.xml");
String containerComponentVisibility = PlexusConstants.GLOBAL_VISIBILITY;
URL overridingComponentsXml = getClass().getClassLoader().getResource("META-INF/**/components.xml");

ContainerConfiguration configuration = new DefaultContainerConfiguration();
configuration.setAutoWiring(isContainerAutoWiring)
Expand All @@ -68,8 +70,11 @@ public PlexusContainer create() {

// inspired from https://github.com/jenkinsci/lib-jenkins-maven-embedder/blob/master/src/main/java/hudson/maven/MavenEmbedderUtils.java#L141
ClassWorld classWorld = new ClassWorld();

log.debug("ClassLoader for Plexus ClassRealm: " + PlexusContainer.class.getClassLoader().getClass().getName());
ClassRealm classRealm = new ClassRealm(classWorld, "maven", PlexusContainer.class.getClassLoader());
ClassLoader effectiveParent = parent == null ? Thread.currentThread().getContextClassLoader() : parent;
log.debug("Effective parent: " + effectiveParent.getClass().getName());
ClassRealm parentRealm = new ClassRealm(classWorld, "maven-parent", effectiveParent);
classRealm.setParentRealm(parentRealm);
configuration.setRealm(classRealm);
Expand Down

0 comments on commit 6bd898c

Please sign in to comment.