jknack / handlebars.java

Logic-less and semantic Mustache templates with Java
http://jknack.github.io/handlebars.java
Other
1.48k stars 383 forks source link

OSGI dependencies problem #480

Closed francescoferrante closed 8 years ago

francescoferrante commented 8 years ago

I'm trying to install a custom handlebars helper on Adobe AEM 6.1, but when I install my bundle which has the dependency

            <dependency>
        <groupId>com.github.jknack</groupId>
        <artifactId>handlebars</artifactId>
        <version>4.0.4</version>
    </dependency> 

then the bundle is unable to go in Active state because it misses a dependency com.github.jknack.handlebars,version=[4.0,5) -- Cannot be resolved

how can it be possible?

jknack commented 8 years ago

here is the manifest for handlebars 4.0.4:

Manifest-Version: 1.0
Export-Package: com.github.jknack.handlebars.cache;uses:="com.github.j
 knack.handlebars,com.github.jknack.handlebars.io,org.apache.commons.l
 ang3.tuple";version="4.0.4",com.github.jknack.handlebars.context;uses
 :="com.github.jknack.handlebars";version="4.0.4",com.github.jknack.ha
 ndlebars;uses:="com.github.jknack.handlebars.cache,com.github.jknack.
 handlebars.io";version="4.0.4",com.github.jknack.handlebars.helper;us
 es:="com.github.jknack.handlebars,com.github.jknack.handlebars.js";ve
 rsion="4.0.4",com.github.jknack.handlebars.io;uses:="javax.servlet";v
 ersion="4.0.4",com.github.jknack.handlebars.js;uses:="com.github.jkna
 ck.handlebars";version="4.0.4"
Built-By: edgar
Tool: Bnd-2.4.1.201501161923
Bundle-Name: Handlebars
Created-By: Apache Maven Bundle Plugin
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.7))"
Build-Jdk: 1.7.0_55
Bundle-Version: 4.0.4
Bnd-LastModified: 1454376964631
Bundle-ManifestVersion: 2
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-Description: Logic-less and semantic templates with Java
Bundle-SymbolicName: com.github.jknack.handlebars
Import-Package: com.github.jknack.handlebars.io,javax.servlet,org.antl
 r.v4.runtime;version="[4.5,5)",org.antlr.v4.runtime.atn;version="[4.5
 ,5)",org.antlr.v4.runtime.dfa;version="[4.5,5)",org.antlr.v4.runtime.
 misc;version="[4.5,5)",org.antlr.v4.runtime.tree;version="[4.5,5)",or
 g.apache.commons.lang3;version="[3.1,4)",org.apache.commons.lang3.bui
 lder;version="[3.1,4)",org.apache.commons.lang3.math;version="[3.1,4)
 ",org.apache.commons.lang3.text;version="[3.1,4)",org.apache.commons.
 lang3.text.translate;version="[3.1,4)",org.apache.commons.lang3.tuple
 ;version="[3.1,4)",org.mozilla.javascript,org.mozilla.javascript.tool
 s,org.slf4j;version="[1.6,2)"
Archiver-Version: Plexus Archiver

don't see a reference to [4.0.5)

francescoferrante commented 8 years ago

In my bundle in the .pom I have

`

com.github.jknack
        <artifactId>handlebars</artifactId>
        <version>4.0.4</version>
    </dependency>`

so how can I have then a manifest with

Import-Package: com.adobe.cq.social.handlebars.api;version="[0.0,1)",com .github.jknack.handlebars;version="[4.0,5)",org.apache.commons.lang3;ve rsion="[3.3,4)"

I saw the manifest you post but I can't explain...

jknack commented 8 years ago

no idea, but can you run mvn dependency:tree and paste the output here?

Think the problem is in com.adobe.cq.social.handlebars.api, but not sure yet.

francescoferrante commented 8 years ago

I have this

[INFO] mygroup:handlebars-custom-helpers:bundle:0.0.1-SNAPSHOT [INFO] +- com.adobe.cq.social:cq-social-handlebars:jar:1.5.20:provided [INFO] +- com.github.jknack:handlebars:jar:4.0.4:compile [INFO] | +- org.antlr:antlr4-runtime:jar:4.5.1-1:compile [INFO] | \- org.mozilla:rhino:jar:1.7R4:compile [INFO] +- org.apache.commons:commons-lang3:jar:3.3.2:compile [INFO] +- org.osgi:org.osgi.compendium:jar:4.2.0:provided [INFO] +- org.osgi:org.osgi.core:jar:4.2.0:provided [INFO] +- org.apache.felix:org.apache.felix.scr.annotations:jar:1.9.4:provided [INFO] +- javax.jcr:jcr:jar:2.0:compile [INFO] +- org.apache.jackrabbit:jackrabbit-api:jar:2.2.0:compile [INFO] +- org.slf4j:slf4j-api:jar:1.5.10:provided [INFO] +- junit:junit:jar:4.8.1:test [INFO] +- org.mockito:mockito-all:jar:1.9.5:test [INFO] \- org.apache.sling:org.apache.sling.commons.testing:jar:2.0.10:test [INFO] +- org.apache.sling:org.apache.sling.api:jar:2.1.0:test [INFO] +- org.apache.sling:org.apache.sling.jcr.api:jar:2.1.0:provided (version managed from 2.0.6; scope managed from test) [INFO] +- org.apache.jackrabbit:jackrabbit-jcr-commons:jar:2.2.9:test [INFO] +- org.apache.jackrabbit:jackrabbit-core:jar:2.2.9:test [INFO] | +- concurrent:concurrent:jar:1.3.4:test [INFO] | +- commons-collections:commons-collections:jar:3.2.1:test [INFO] | +- commons-dbcp:commons-dbcp:jar:1.2.2:test [INFO] | | \- commons-pool:commons-pool:jar:1.3:test [INFO] | +- org.apache.jackrabbit:jackrabbit-spi-commons:jar:2.2.9:test [INFO] | +- org.apache.jackrabbit:jackrabbit-spi:jar:2.2.9:test [INFO] | +- org.apache.tika:tika-parsers:jar:0.8:test [INFO] | | +- org.apache.tika:tika-core:jar:0.8:test [INFO] | | +- org.apache.commons:commons-compress:jar:1.1:test [INFO] | | +- org.apache.pdfbox:pdfbox:jar:1.3.1:test [INFO] | | | +- org.apache.pdfbox:fontbox:jar:1.3.1:test [INFO] | | | \- org.apache.pdfbox:jempbox:jar:1.3.1:test [INFO] | | +- org.bouncycastle:bcmail-jdk15:jar:1.45:test [INFO] | | +- org.bouncycastle:bcprov-jdk15:jar:1.45:test [INFO] | | +- org.apache.poi:poi:jar:3.7:test [INFO] | | +- org.apache.poi:poi-scratchpad:jar:3.7:test [INFO] | | +- org.apache.poi:poi-ooxml:jar:3.7:test [INFO] | | | +- org.apache.poi:poi-ooxml-schemas:jar:3.7:test [INFO] | | | | \- org.apache.xmlbeans:xmlbeans:jar:2.3.0:test [INFO] | | | \- dom4j:dom4j:jar:1.6.1:test [INFO] | | +- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:test [INFO] | | +- org.ccil.cowan.tagsoup:tagsoup:jar:1.2:test [INFO] | | +- asm:asm:jar:3.1:test [INFO] | | +- com.drewnoakes:metadata-extractor:jar:2.4.0-beta-1:test [INFO] | | +- de.l3s.boilerpipe:boilerpipe:jar:1.1.0:test [INFO] | | \- rome:rome:jar:0.9:test [INFO] | | \- jdom:jdom:jar:1.0:test [INFO] | +- edu.ucar:netcdf:jar:4.2-min:test [INFO] | +- org.slf4j:jcl-over-slf4j:jar:1.5.11:test [INFO] | +- org.apache.lucene:lucene-core:jar:2.4.1:test [INFO] | \- org.apache.derby:derby:jar:10.5.3.0_1:test [INFO] +- commons-io:commons-io:jar:1.4:test [INFO] +- org.apache.sling:org.apache.sling.adapter:jar:2.0.4:test [INFO] | \- org.apache.sling:org.apache.sling.commons.osgi:jar:2.0.2-incubator:test [INFO] +- rhino:js:jar:1.6R6:test [INFO] +- commons-httpclient:commons-httpclient:jar:3.1:test [INFO] | \- commons-codec:commons-codec:jar:1.2:test [INFO] +- org.slf4j:slf4j-simple:jar:1.5.2:test [INFO] \- org.jmock:jmock-junit4:jar:2.5.1:test [INFO] +- org.jmock:jmock:jar:2.5.1:test [INFO] | +- org.hamcrest:hamcrest-core:jar:1.1:test [INFO] | \- org.hamcrest:hamcrest-library:jar:1.1:test [INFO] \- junit:junit-dep:jar:4.4:test

A note, for the antlr-runtime packages imported by handlebars as shown in the manifest posted by you I noticed that last version in the maven central repo is 4.5.2-1 not 4.5.5 Can this have something to do with the issue?

jknack commented 8 years ago

dependency tree looks fine to me.

Don't think so, what I posted is [4.5,5) do you see the ,? That's an OSGi range means, any version equal or higher than 4.5 but not 5

francescoferrante commented 8 years ago

I confuse the "," with "."

So now we're back to the starting point, I'm trying to figure out

francescoferrante commented 8 years ago

Where can I find an OSGI for the 4.0.4 version of handlebars.java?

jknack commented 8 years ago

It's the same .jar with a META-INF/MANIFEST.MF

francescoferrante commented 8 years ago

If I try to build this jar, using this git project, it fails during maven test phase

jknack commented 8 years ago

there is a git submodule with mustache tests, you need to initialize the git submodule

francescoferrante commented 8 years ago

I think I solved, really thank you :)

jknack commented 8 years ago

np, glad you solved it!

Also, invite you to try: http://jooby.org

rajramo61 commented 7 years ago

@jknack @francescoferrante I see that issue is resolved but no described here. @francescoferrante could you please summarize the fix you did? I am seeing the same issue with my project.