Container Dependencies

Hello folks,

In our company we have to support old project which use the old JBOSS ESB. Buildship gradle plugin couldn’t load esb archives (same structure as zip, but extension is .esb) to container “Project and External Dependencies” ( old STS gradle plugin easly load such dependency). Building projects from eclipse or console works fine but eclipse compiler raise errors because there is no class which are into esb archive.
Sample snapshot from build.gradle of such dependency:

dependencies
{
compile “com.xyz.xyz:foo-bar:”+appVersion+“@esb
}

I’m shyly changed class

/org.eclipse.buildship.core/src/main/java/org/eclipse/buildship/core/internal/workspace/GradleClasspathContainerUpdater.java

precisely this line:

if (dependencyFile.isDirectory() || dependencyName.endsWith(“.jar”) || dependencyName.endsWith(“.zip”)) {

to something like that:

if (dependencyFile.isDirectory() || isZipArchive( dependencyFile )) {



private boolean isZipArchive( File dependencyFile )
{
return getFileSignature( dependencyFile ) == ZIP_SIGNATURE;
}
private int getFileSignature( File dependencyFile )
{
int signature;
try
{
RandomAccessFile raf = new RandomAccessFile( dependencyFile, “r”);
signature = raf.readInt();
raf.close();
}
catch( IOException exception )
{
throw new IllegalArgumentException( exception );
}
return signature;
}

Finally I replaced the class in org.eclipse.buildship.core.jar and the cointainer and eclipse compiler works fine.
Moreover checking file based on extension (in this case .jar or .zip) it seems as not god option.

My question is, do you will consider add such fix/feature to the code??

Best Regards,
Damian Baliński