Last active
November 28, 2019 18:32
-
-
Save mateidavid-work/2d9b8e17bca87b418305d5cdcc698314 to your computer and use it in GitHub Desktop.
How to collapse source sets in a java library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id "java-library" | |
} | |
sourceSets { | |
base { | |
} | |
} | |
dependencies { | |
api sourceSets.base.output | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id "java" | |
} | |
sourceSets { | |
base { | |
} | |
main { | |
output.dir(sourceSets.base.output) | |
} | |
} | |
dependencies { | |
compileOnly sourceSets.base.output | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package local.api.base; | |
public enum AnEnum {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package local.api.main; | |
import local.api.base.AnEnum; | |
public interface AnInterface { | |
AnEnum anEnum(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id "java-library-distribution" | |
} | |
dependencies { | |
implementation project(":impl") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id "java-library" | |
} | |
dependencies { | |
api project(":api") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package local.impl.main; | |
import local.api.base.AnEnum; | |
import local.api.main.AnInterface; | |
public class AClass implements AnInterface { | |
@Override | |
public AnEnum anEnum() { | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment