Hi, core team.
I think a java library name should be validated in java-lang
plugin.
If the following build script is given, component
task can be executed, but build
task(to be more precise compile../srcJar../srcJava
task) will fail.
plugins {
id 'jvm-component'
id 'java-lang'
}
model {
components {
'../src'(JvmLibrarySpec)
}
}
$ gradle components
:components
------------------------------------------------------------
Root project
------------------------------------------------------------
JVM library '../src'
--------------------
Source sets
Java source '../src:java'
srcDir: src/java
JVM resources '../src:resources'
srcDir: src/resources
Binaries
Jar '../srcJar'
build using task: :../srcJar
targetPlatform: Java SE 8
tool chain: JDK 8 (1.8)
Jar file: build/src.jar
Note: currently not all plugins register their components, so some components may not be visible here.
BUILD SUCCESSFUL
Total time: 0.777 secs
$ gradle build
:compile../srcJar../srcJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compile../srcJar../srcJava'.
> ディレクトリがありません: /Users/mike/IdeaProjects/gradle-projects/gradle-self-training/component-name/build/classes/../srcJar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 0.761 secs
(ディレクトリがありません means directory is not found.)
Of course directory structure is created properly.
$ tree .
.
├── build.gradle
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── src
├── java
│ └── com
│ └── test
│ └── Main.java
└── resources
└── test.txt
I think these java library names should be prohibited.
- A library name using
.
without any alphabet and numeric characters. - A library name using
/
after..
or after/../
.
Regards.