-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help required for the deploy the Osgi Bundles #27
Comments
What does it say when you do the |
Executing task ':projectname-core:install' (up-to-date check took 0.0 secs) due to: I have 3 osgi bundles and one content package.The content package is installing when I tried the workaround you mentioned.But the other 3 bundles which were installed before the latest git changes are not being installed now.The above output is for one of the osgi bundles.It is the same for the other two as well. I am running the gradlew clean install -iS at the parent folder which encompasses all the 3 osgi bundles and the one content package project.I see the osgi bundles getting generated under the build folder of each of the osgi projects and the zip file gets installed for the content package.The only problem is with the Osgi bundles. Also I have applied the sling-plugin for the 3 osgi bundles and cqpackage for the content module and not vice versa. |
That's caused by a conflict with the maven plugin // remove "mvn install" since it's not needed and causes a conflict
def installTask = tasks.findByPath('install')
if (installTask != null) tasks.remove(installTask) |
Hi Jim, I do not have the install anymore in all of the modules.I have removed the apply plugin: 'maven' in all my build.gradle files but still the result is same.I am running by giving the command gradlew clean install..Is there anything else I need to correct? |
I realized that removing the apply-plugin:'maven' doesnt even invoke the install in the tasks list iS ouput.I have applied it back but still having the same issue |
You have something overriding the |
Thanks Jim.I will try to find it out. I was not able to find it in the master branch by doing a file search. |
BTW, the reason there's no For example, when using the configurations.cq_package {
exclude group: 'commons-io', module: 'commons-io'
} to tell it what dependencies to not include when building the zip. |
Is the below plugin required If I use the sling-plugin? apply plugin: 'osgi' Also does your plugin read anything in the existing pom.xml files of the project modules? |
No file of the project has the The If you don't apply the |
Now I have removed all other modules and ran a build for only one of the Osgi Bundles.Below is the (gradlew clean install -iS) output.Also it printed the list of tasks and there is only one install task.Can you please suggest any other way to debug this? F:\projectname-core>gradlew clean install -iS BUILD SUCCESSFUL Total time: 9.707 secs |
Ok so I have come to a point where if I remove the apply plugin: 'maven' from build.gradle file the build fails with the message: org.gradle.execution.TaskSelectionException: Task 'install' not found in root project 'projectname-core'. So I am assuming all this while the install command is being executed from the maven plugin in the build.gradle file.So which task in the sling-bundle plugin should I be invoking now for executing the install command now? My modified build.gradle file for the single Osgi module: group = 'com.projectname' buildscript {
} allprojects { repositories {
} } apply plugin: 'java' apply plugin: 'sling-bundle' slingServers.author.installPath = '/apps/projectname/install' dependencies { } uploadBundle{ showBundle { |
🐼 There is no |
oh ok.Now when I invoke the command gradlew uploadBundle,it fails with error: Could not find id for com.projectname.core.I believe I need to change something in my config files to pass it on to the plugin? |
It failed because the guava jar which gets embedded is missing in the plugin generated osgi bundle.How can I embed the missing jar to the generated osgi bundle? |
"How can I embed the missing jar to the generated osgi bundle?" Short answer: You don't. That's what the CQ Package Manager is for. Use the "cqpackage" plugin. Longer answer: You can create a "fat jar", but the reasons for and against doing so, including how, are beyond scope... |
FWIW, starting in AEM 6.0, Google Guava is included in AEM and will likely give you trouble unless you really know what you're doing. Use the v15 that AEM6 comes with. |
oh ok.So if I use the cqpackage plugin the build fails stating that the contentSrc path is wrong since I do not have jcr_root like structure for this osGi bundle module.I have src/main/java and also I observed that OSGI-INF folder doesn't get generated. |
You'd need at least some content if for nothing else than for the
|
When I apply the scr plugin here is the error: Execution failed for task ':projectname-core:processScrAnnotations'.
|
Don't forget to run Gradle with the |
Sorry Jim,Yes I did do that but pasted only the topmost message.Here is the complete stack trace:
|
These are the plugins am using in that order: apply plugin: 'java' and also I had to create a dummy META-INF folder under the projectname-core/src/main/ in order to use the cqpackage plugin.Is there a way that I can indicate to the plugin that I am actually building a OSGI bundle and not a content package? Also guava jar was an example but we would have more third party jars that would need to be embedded with the OSGI bundle in the future.Though we can remove the guava jar for now,we would probably end up having the same issue next time. |
So currently I removed the guava dependency and trying to build an OSGI jar but it is failing with same error however the difference now is that I can see my projectname-core bundle in the OSGI bundle console.That is probably because it is uninstalling and then checking for the bundle.Please find below log: Uninstalling com.projectname.core FAILURE: Build failed with an exception.
|
So I invoked the showBundle task after the uploadbundle and here is the output: {"status":"Bundle information: 435 bundles in total - all 435 bundles active.","s":[435,427,8,0,0],"data":[{"id":583,"name":"projectname-core","............... |
"Is there a way that I can indicate to the plugin that I am actually building a OSGI bundle and not a content package?" Yes, don't include the 'cqpackage' plugin. Again, bundles and packages serve different purposes. What command are you using to install the bundle? Just a simple |
Yes Jim. I am using gradlew uploadBundle -iS Below is the list of plugins snippet from my build gradle file: apply plugin: 'java' slingServers.author.installPath = '/apps/projectname/install' ..................................................... Executing task ':projectname-core:uploadBundle' (up-to-date check took 0.001 secs) due to: FAILURE: Build failed with an exception.
|
Just to level-set: This is happening with version '3.0.2' of the plugins? |
So I changed it to classpath 'com.twcable.gradle:cq-gradle-plugins:3.0.2' and still the same error |
And sometimes I get a build failure with while trying to upload the bundle generated in the build/libs folder. Caused by: java.lang.IllegalStateException: Could not find id for com.projectName.core |
Is your bundle's id "com.projectName.core"? Are you setting it explicitly in MANIFEST.MF? |
I am not setting it in MANIFEST explicitly.The plugin is generating it dynamically and in the generated MANIFEST I have the following: |
Hi Jim,
Now I am facing problems with the OsgI bundles.I am applying the plugin sling-bundle and issuing the gradlew clean install.
The Osgi bundle is getting generated locally in the build/libs folder of the project but nothing happens after that.Build is successful but the bundle doesn't get installed or even uploaded.
I am using the defaults except for the install path location.Am I invoking the plugin wrongly?
Please help.
Below is the build.gradle file I am using:
group = 'com.projectname'
description = 'ProjectName Core'
version = '0.1-SNAPSHOT'
configurations {
provided
compile.transitive = true
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'osgi'
apply plugin: 'sling-bundle'
slingServers.author.installPath = '/apps/projectname/install'
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile group: 'org.slf4j', name: 'slf4j-simple', version:'1.6.4'
compile group: 'org.slf4j', name: 'slf4j-api', version:'1.6.6'
compile group: 'org.apache.felix', name: 'org.osgi.core', version:'1.4.0'
compile group: 'org.apache.felix', name: 'org.apache.felix.scr', version:'1.6.0'
compile group: 'commons-collections', name: 'commons-collections', version:'3.0'
compile group: 'commons-lang', name: 'commons-lang', version:'2.3'
compile group: 'com.google.guava', name: 'guava', version:'14.0'
compile(group: 'org.apache.felix', name: 'org.apache.felix.scr.annotations', version:'1.9.10') {
/* This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: 'org.apache.felix', name: 'org.apache.felix.ipojo', version:'1.8.0') {
/ This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: 'org.osgi', name: 'org.osgi.core', version:'4.2.0') {
/ This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: 'javax.servlet', name: 'servlet-api', version:'2.5') {
/ This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: 'javax.servlet', name: 'jsp-api', version:'2.0') {
/ This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: 'com.adobe.aem', name: 'aem-api', version:'6.0.0.1') {
/ This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. /
}
compile(group: 'org.apache.sling', name: 'org.apache.sling.jcr.jcr-wrapper', version:'2.0.0') {
/ This dependency was originally in the Maven provided scope, but the project was not of type war.
This behavior is not yet supported by Gradle, so this dependency has been converted to a compile dependency.
Please review and delete this closure when resolved. */
}
}
uploadBundle{
}
showBundle {
}
The text was updated successfully, but these errors were encountered: