# Java library name should be validated. (java-lang plugin)

**URL:** <https://discuss.gradle.org/t/java-library-name-should-be-validated-java-lang-plugin/12882>\
**Category:** Help/Discuss\
**Created:** [November 22, 2015, 12:44pm UTC](https://discuss.gradle.org/t/java-library-name-should-be-validated-java-lang-plugin/12882 "2015-11-22T12:44:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shinya\_Mochida](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/shinya_mochida/32/2393_2.png) [@Shinya\_Mochida](https://discuss.gradle.org/u/Shinya_Mochida)\
**Post date:** [November 22, 2015, 12:44pm UTC](https://discuss.gradle.org/t/java-library-name-should-be-validated-java-lang-plugin/12882/1 "2015-11-22T12:44:47Z")

</div>

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.

```groovy
plugins {
    id 'jvm-component'
    id 'java-lang'
}
model {
    components {
        '../src'(JvmLibrarySpec)
    }
}

```

```nohighlight
$ 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.

```gradle
$ 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.
