I have following 2 projects placed adjacent to each other in some folder and I want to include specific sources from a non-gradle project into this project with the structure as follows.
rootfolder/
my-gradle-project/
src/main/java
build.gradle
my-non-gradle-project/
src/main/java/com/example/utils
In build.gradle why would following not work ? What alternative do I have ?
Additionally I need to included specific java sources from the non-gradle project.
build.gradle
sourceSets.main.java.srcDirs = [
'src/main/java',
'../my-non-gradle-project/src/main/java/com/example/util')]
The subproject producer defines a task named buildInfo that generates a properties file containing build information e.g. the project version. You can then map the task provider to its output file and Gradle will automatically establish a task dependency.
To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build.gradle file.
A FileTree represents a hierarchy of files. It extends FileCollection to add hierarchy query and manipulation methods. You typically use a FileTree to represent files to copy or the contents of an archive. You can obtain a FileTree instance using Project.
runtimeClasspath' contains the compiled classes of the source set, and task autowiring automatically adds the necessary task dependencies. Maybe you want 'sourceSets. main. compileClasspath'.
The following worked in intelliJ:
...
group 'org.example'
version '1.0-SNAPSHOT'
sourceSets {
main {
java{
srcDirs '../my-non-gradle-project/src/main/java/com/example/util' /* include proto files from base project level */
}
}
}
sourceCompatibility = 1.11
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With