Building cartridges directly in Intershop Studio may not detect missing dependencies in some cases which could lead to compilation errors. This document describes how to handle such cases to resolve missing dependencies.
To identify missing dependencies in your project cartridge that are necessary to compile Java source files, execute a gradle build process for all cartridges in a separate shell/cmd.
./gradlew build -s
If there are any dependencies missing, the output will display an error, e.g. the message "cannot find symbol" or "cannot access <class>" identifies missing dependencies.
Example when compile group: 'com.intershop.business', name: 'bc_basket'
is missing in the dependencies of the cartridge app_sf_responsive:
/home/intershop1/intershop-cisetup-sources/projects/a_responsive/app_sf_responsive/src/main/java/com/intershop/application/responsive/pipelet/GetPaymentInstrumentByServiceID.java:8: error: cannot find symbol import com.intershop.component.basket.capi.BasketBO; ^ symbol: class BasketBO location: package com.intershop.component.basket.capi :inspired-b2x:generateDescriptorFileForIvyPublication 1 error :app_sf_responsive:compileJava FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app_sf_responsive:compileJava'. > Compilation failed; see the compiler error output for details. * Try: Run with --info or --debug option to get more log output. * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app_sf_responsive:compileJava'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details. at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:47) at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:33) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:103) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:52) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:38) at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:34) at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25) at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:157) at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:139) at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:93) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) ... 14 more
Example when compile 'org.apache.tomcat:tomcat-jsp-api'
is missing in the dependencies of a project cartridge:
/home/intershop1/intershop-cisetup-sources/projects/a_responsive/my_cartridge/src/main/java/com/intershop/application/responsive/internal/configuration/MyClass.java:710: error: cannot access HttpJspPage LoopStack loopStack = AbstractTemplate.getTemplateExecutionConfig().getLoopStack(); ^ class file for javax.servlet.jsp.HttpJspPage not found
Example when compile group: 'com.intershop', name: 'emf'
is missing in the dependencies of a project cartridge:
/home/intershop1/intershop-cisetup-sources/projects/a_responsive/my_cartridge/javasource/com/intershop/application/responsive/pipelet/MyClass.java:710: error: cannot access ResourceSetIdentifiable dict.put("PageletEntryPointID", pageletEntryPointPO.getId()); ^ class file for com.intershop.beehive.emf.core.ResourceSetIdentifiable not found
The description of the subsequent steps is based on the example when compile group: 'com.intershop.business', name: 'bc_basket'
is missing.
After the missing classes have been identified, the next step is to find the related Java packages where the classes are included in order to add this package to the cartridge dependencies list. Here, the Intershop Studio can be used.
The steps are:
Open the ivy.xml file in the server share directory and search for the Java package name.
Note
The name of the Java package equals the cartridge name in which the Java package is located (the .jar file is part of the cartridge lib folder).
Add the missing Java package dependency to the cartridge build.gradle file.
<root-project>/app_sf_responsive/build.gradle: ... dependencies { ... compile group: 'com.intershop.business', name: 'bc_basket' ... } }