FlatDir subproject problem


(Cristiano Martini Bergamo) #1

Hello guys. I’m having trouble with a independent subproject dependency.

Here is the structure of my projects:

  1. mbsdblogin
  • build.gradle
apply plugin: 'java'
apply plugin: 'idea'
buildscript {
	repositories {
		jcenter()
		flatDir {
			dirs "${project(':mbsseg').projectDir}\\jar"
		}
	}
}
repositories {
	jcenter()
}
dependencies {
	compile project(':mbsseg')
}
  • settings.gradle
include ':mbsseg'
project(':mbsseg').projectDir = new File(settingsDir, '../mbsseg')
rootProject.name = 'mbsdblogin'
  1. mbsseg
  • build.gradle
apply plugin: 'java'
apply plugin: 'idea'
repositories {
	jcenter()
	flatDir {
		dirs 'jar'
	}
}
dependencies {
	runtime name: 'sun.misc.BASE64Decoder'
	runtime name: 'commons-lang3-3.4'
	
}
  • settings.gradle
    > rootProject.name = 'mbsseg'

Long history short, if i run the build task from mbsseg, everythings works. If I run build task from mbsdblogin, the errows bellow happens:

:mbscon:compileJava UP-TO-DATE
:mbscon:processResources UP-TO-DATE
:mbscon:classes UP-TO-DATE
:mbscon:jar UP-TO-DATE
:mbsseg:compileJava
C:\Users\Cristiano\intelliJ_workspace\mbsseg\src\main\java\com\mbs\security\Encrypt.java:26: error: package Decoder does not exist
        return new Decoder.BASE64Encoder().encode(encVal);
                          ^
C:\Users\Cristiano\intelliJ_workspace\mbsseg\src\main\java\com\mbs\security\Encrypt.java:34: error: package Decoder does not exist
        String encryptedValue = new Decoder.BASE64Encoder().encode(encVal);
                                           ^
C:\Users\Cristiano\intelliJ_workspace\mbsseg\src\main\java\com\mbs\security\Encrypt.java:42: error: package Decoder does not exist
        byte[] decordedValue = new Decoder.BASE64Decoder().decodeBuffer(_encryptedData);
                                          ^
C:\Users\Cristiano\intelliJ_workspace\mbsseg\src\main\java\com\mbs\security\Encrypt.java:52: error: package Decoder does not exist
        byte[] decordedValue = new Decoder.BASE64Decoder().decodeBuffer(param);
                                          ^
4 errors
:mbsseg:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mbsseg:compileJava'.
> Compilation failed; see the compiler error output for details.
* 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: 3.72 secs

What can I do to make the build works?


(Francois Ritaly) #2

Your dependency on ‘sun.misc.BASE64Decoder’ is defined as a runtime dependency, it should be a compile one


(Cristiano Martini Bergamo) #3

Thanks for the answer, but this is not the problem.
It was compile, I changed because was not working.
So, the problem still happen.