Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eclipse classpath builder adds wrong source folders #41

Closed
cuchaz opened this issue Nov 21, 2016 · 2 comments
Closed

eclipse classpath builder adds wrong source folders #41

cuchaz opened this issue Nov 21, 2016 · 2 comments

Comments

@cuchaz
Copy link
Contributor

cuchaz commented Nov 21, 2016

If my build script has these overrides on the JkJavaBuild template:

@Override
public JkFileTreeSet editedSources() {
	return JkFileTreeSet.of(file("src"));
}

@Override
public JkFileTreeSet editedResources() {
	return super.editedResources()
		.and(baseDir().andFilter(JkPathFilter.include("LICENSE.txt")));
}

Then the eclipse classpath has "." and "./src" as source folders, but only "src" should be the source folder. "." should not be a source folder.

I'm using jerkar compiled from commit a9faab6

I'm guessing this could be tricky to fix... because resource folders generally should be on the classpath. Except, I'm using the resource system to include LICENSE.txt in the jar file like you suggested, even though LICENSE.txt isn't really a resource and it doesn't need to be on the classpath.

Maybe we need a mechanism to include non-classpath files in Jars that is separate from the resource mechanism? Or teach the resource mechanism to not create source folders for file resources?

@djeang
Copy link
Contributor

djeang commented Nov 21, 2016

If you want these files not been included in the Eclipse build path than this mean that it should not be considered as resources.
There is 2 points

  • there is a bug cause normally Jerkar should include "." in Eclipse buildpath but with inclusion of "License.txt" so only this file is in the buildpath, not the whole project.

  • You're right, a method like JkJavaPacker#withExtraFilesInJar(JkFileTree) is more appropriate to include files that only need to be there at jar creation time. If you want to implement that you're more than welcome.

@cuchaz
Copy link
Contributor Author

cuchaz commented Nov 21, 2016

Ok, I'll send a PR with a withExtraFilesInJar() feature. Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants