[ https://issues.apache.org/jira/browse/SUREFIRE-1198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15504700#comment-15504700 ]
Phillip Webb edited comment on SUREFIRE-1198 at 9/19/16 9:08 PM: ----------------------------------------------------------------- I spoke with [~rfscholte] a little about this issue today. One option we might have is to find some way of plugging in a custom classloader that can deal with Spring Boot's layouts. This does seem quite involved so I wondering if instead we shouldn't look at what can be done with the {{getClassesDirectory()}} method. Currently it looks like this: {code:java} public File getClassesDirectory() { Artifact artifact = getProject().getArtifact(); File artifactFile = artifact.getFile(); boolean useArtifactFile = artifactFile != null && artifactFile.isFile() && artifactFile.getName().toLowerCase().endsWith( ".jar" ); return useArtifactFile ? artifactFile : classesDirectory; } {code} This is appears to be saying "use the main artifact, if it's a JAR, otherwise use the classesDirectory". So, if the main artifact is set (which it will be if failsafe is bound the expected lifecyle) there is no way to force the {{classesDirectory}} to be used. Perhaps we could change that logic so that if a specific {{classesDirectory}} attribute has been configured, it's always used. That way Spring Boot could either set {{classesDirectory}} to {{${project.build.outputDirectory}} to force use of the folder or, more likely, set it to point to the original jar (before it was repackaged). was (Author: pwebb): I spoke with [~rfscholte] a little about this issue today. One option we might have is to find some way of plugging in a custom classloader that can deal with Spring Boot's layouts. This does seem quite involved so I wondering if instead we shouldn't look at what can be done with the {{getClassesDirectory()}} method. Currently it looks like this: {code:java} public File getClassesDirectory() { Artifact artifact = getProject().getArtifact(); File artifactFile = artifact.getFile(); boolean useArtifactFile = artifactFile != null && artifactFile.isFile() && artifactFile.getName().toLowerCase().endsWith( ".jar" ); return useArtifactFile ? artifactFile : classesDirectory; } {code} This is appears to be saying "use the main artifact, if it's a JAR, otherwise use the classesDirectory". So, if the main artifact is set (which it will be if failsafe is bound the expected lifecyle) there is no way to force the {{classesDirectory}} to be used. Perhaps we could change that logic so that a specific {{classesDirectory}} attribute has been configured, it's always used. That way Spring Boot could either set {{classesDirectory}} to {{${project.build.outputDirectory}} to force use of the folder or, more likely, set it to point to the original jar (before it was repackaged). > Failsafe does not allow to configure the jar file to use > -------------------------------------------------------- > > Key: SUREFIRE-1198 > URL: https://issues.apache.org/jira/browse/SUREFIRE-1198 > Project: Maven Surefire > Issue Type: Improvement > Reporter: Stephane Nicoll > > See [this Spring Boot > issue|https://github.com/spring-projects/spring-boot/issues/4510#issuecomment-159448634] > It seems that SUREFIRE-855 does not allow {{target/classes}} to be used > anymore. Is there a reason why this behaviour was completely removed in > favour of only the jar file? > It would be nice if we had an option to chose between the two (defaulting to > the jar) -- This message was sent by Atlassian JIRA (v6.3.4#6332)