Skip to content

Commit

Permalink
fix wrong resources directory path
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com>

fix typo of resourcesDirectory javadoc in JavaProject class

Signed-off-by: Oleksandr Krutko <alexander.krutko@gmail.com>
  • Loading branch information
arsenalzp committed Apr 6, 2024
1 parent b10c54f commit 4f19318
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ public class JavaProject implements Serializable {
* @return The base directory for the project.
*/
private File baseDirectory;
/**
* Project's resources directory
*
* @param resourcesDirectory resources directory where project resources look for.
* @return The resources directory for the project.
*/
private File resourcesDirectory;
/**
* Directory where all build files are located (e.g. target)
*
Expand Down Expand Up @@ -293,6 +300,7 @@ public JavaProject(
this.scmTag = scmTag;
this.buildPackageDirectory = buildPackageDirectory;
this.maintainers = maintainers;
this.resourcesDirectory = baseDirectory != null ? new File(baseDirectory.getAbsolutePath() + "/src/main/resources") : new File("src/main/resources");
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ public static String createDefaultResourceName(String artifactId, String ... suf
public static URLClassLoader getClassLoader(JavaProject jKubeProject) {
return ClassUtil.createClassLoader(
jKubeProject.getCompileClassPathElements(),
jKubeProject.getOutputDirectory().getAbsolutePath());
jKubeProject.getOutputDirectory().getAbsolutePath(),
jKubeProject.getResourcesDirectory().getAbsolutePath());
}

public static String getProperty(String key, JavaProject project) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void setUp(@TempDir Path target) throws IOException {
project = JavaProject.builder()
.properties(properties)
.outputDirectory(target.toFile())
.baseDirectory(target.toFile())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ void getSpringBootApplicationProperties_withCompileClassloader_shouldLoadPropert
JavaProject javaProject = JavaProject.builder()
.compileClassPathElement(Objects.requireNonNull(getClass().getResource("/util/springboot/resources")).getPath())
.outputDirectory(new File("target"))
.baseDirectory(new File("target"))
.build();
URLClassLoader compileClassLoader = JKubeProjectUtil.getClassLoader(javaProject);

Expand Down

0 comments on commit 4f19318

Please sign in to comment.