Liferay 7.2 No value has been specified for property 'apiDir'

2.2k views Asked by At

I created a module project using servicebuild template (gradebook-api, gradebook-service), but i have an error after an export package com.liferay.training.gradebook.validator in api below

Bundle-Name: gradebook-api
Bundle-SymbolicName: com.liferay.training.gradebook.api
Bundle-Version: 1.0.0
Export-Package: \
    com.liferay.training.gradebook.exception,\
    com.liferay.training.gradebook.model,\
    com.liferay.training.gradebook.service,\
    com.liferay.training.gradebook.service.persistence,\
    com.liferay.training.gradebook.validator
-check: EXPORTS
-includeresource: META-INF/service.xml=../gradebook-service/service.xml

i have a problem in the BuildService gradle task that's says :

Some problems were found with the configuration of task ':modules:gradebook:gradebook-api:buildService' (type 'BuildServiceTask').

File 'C:\Liferay\ide-workspace\training-workspace\modules\gradebook\gradebook-api\service.xml' specified for property 'inputFile' does not exist. No value has been specified for property 'apiDir'.

And this is a how I add the api module as dependency in service.

dependencies {

    compileOnly group: "com.liferay", name: "com.liferay.petra.io"
    compileOnly group: "com.liferay", name: "com.liferay.petra.lang"
    compileOnly group: "com.liferay", name: "com.liferay.petra.string"
    compileOnly group: "com.liferay", name: "com.liferay.portal.aop.api"
    compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel"
    compileOnly group: "org.osgi", name: "org.osgi.annotation.versioning"
    compileOnly group: "org.osgi", name: "org.osgi.core"
    compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations"
    compileOnly group: "javax.portlet", name: "portlet-api"
    compileOnly group: "javax.servlet", name: "javax.servlet-api"
    compile project(":modules:gradebook:gradebook-api")

}

buildService {
    apiDir = "../gradebook-api/src/main/java"
}

group = "com.liferay.training.gradebook"

I am trying to create new Liferay workspace but i got the same error (May be this is an error with Gradle)

5

There are 5 answers

0
Eoin H On

Until recently I have only worked on LR 7.0, but the last day or so have been playing with 7.3. I encountered the exact issue you describe.

The only solution I found was to copy service.xml from gradebook-service into the root of both my gradebook-api and gradebook-web modules and also add the following to the build.gradle files of both the gradebook-api and gradebook-web modules:

buildService {
    apiDir = "../gradebook-api/src/main/java"
}

After that service builder ran successfully. There may be a cleaner way around it, but this worked for me.

1
Souvik On

In the Gradle task tab, go to your specific module service folder and then build it from there. Don't forget to refresh your gradle by pressing Cntrl+F5. This Worked for me.

0
Mihály Szőnyi On

Be sure, you run gradle task in the corresponding folder (in gradebook-service folder). I got similar error when I ran it in upper folder which contains api and service folder.

0
Quitumba Culyssander On

I had the same situation and just added the buildService{...} in build.gradle in the api module.

buildService {
    apiDir = "../gradebook-api/src/main/java"
}

After: BUILD SUCCESSFUL

0
sanket patel On

service.xml should stay in service module only. Here, it look you need few checks.

  1. api module dependency should be compileonly. not in compile scope.
  2. block order also matters in gradle file. move below block at the top of the file.
buildService {
        apiDir = "../gradebook-api/src/main/java"
}
  1. not sure why you need -check:exports header in bnd file. As, that is not required normally.