You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by janandith jayawardena <ja...@gmail.com> on 2008/06/03 15:59:26 UTC

Re: what is the correct way to run non javascript embedded in html using sling.

Hi,

I think the reason is because the scala library which contains the
interpreter is not correctly loading for the script to run.


This is because in the launchpad I don't see the scala.tools.nsc library
loaded.

I can only see the following,

"imported Packagesjavax.script,version=0.0.0 from System Bundle (0)
org.apache.sling.scripting.api,version=2.0.0.incubator-SNAPSHOT from
org.apache.sling.scripting.api (3)"


I guess my maven configuration is not correct. What is the correct way to
add a dependancy to load in sling.

The pom.xml I created is as follows, Apart from this I added the path to the
source folder in the pom.xml file found in sling main directory. please
point out any error I've done.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.apache.sling</groupId>
        <artifactId>sling</artifactId>
        <version>1-incubator-SNAPSHOT</version>
        <relativePath>../../parent/pom.xml</relativePath>
    </parent>

    <artifactId>org.apache.sling.scripting.javascript</artifactId>
    <version>2.0.0-incubator-SNAPSHOT</version>
    <packaging>bundle</packaging>

    <name>Sling - Scripting - JavaScript Support</name>
    <description>Support for JavaScript scripting</description>

    <scm>
        <connection>
            scm:svn:
http://svn.apache.org/repos/asf/incubator/sling/trunk/scripting/javascript
        </connection>
        <developerConnection>
            scm:svn:
https://svn.apache.org/repos/asf/incubator/sling/trunk/scripting/javascript
        </developerConnection>
        <url>

http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/javascript
        </url>
    </scm>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Private-Package>
                            org.apache.sling.scripting.javascript.*,
                            org.mozilla.classfile,
                            !org.mozilla.javascript.xml.impl.xmlbeans,
                            org.mozilla.javascript.*
                        </Private-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                        <ScriptEngine-Name>${pom.name}</ScriptEngine-Name>

<ScriptEngine-Version>${pom.version}</ScriptEngine-Version>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.api</artifactId>
            <version>2.0.0-incubator-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.scripting.api</artifactId>
            <version>2.0.0-incubator-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.jcr.resource</artifactId>
            <version>2.0.0-incubator-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.commons.testing</artifactId>
            <version>2.0.0-incubator-SNAPSHOT</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.jackrabbit</groupId>
            <artifactId>jackrabbit-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.commons.json</artifactId>
            <version>2.0.0-incubator-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.jcr</groupId>
            <artifactId>jcr</artifactId>
        </dependency>
        <dependency>
            <groupId>rhino</groupId>
            <artifactId>js</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <!-- Testing -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

thanks,
janandith

Re: what is the correct way to run non javascript embedded in html using sling.

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Janandith,

Am Mittwoch, den 04.06.2008, 22:40 +0530 schrieb janandith jayawardena:
> Hi Felix,
> 
> I've created a jira issue and attached the code as scala.tar.gz  till I'm
> able  to  commit to  the  google project.

Cool. Thanks. Aparently Bertrand has fixed the google codes project.
Still having the JIRA issue is of course required to move any google
code over to the Sling code base.


> 
> Please have a look at it.

Will do. Thanks.

Regards
Felix


Re: what is the correct way to run non javascript embedded in html using sling.

Posted by janandith jayawardena <ja...@gmail.com>.
Hi Felix,

I've created a jira issue and attached the code as scala.tar.gz  till I'm
able  to  commit to  the  google project.

Please have a look at it.

janandith.

Re: what is the correct way to run non javascript embedded in html using sling.

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

The attached pom looks like the Rhino/Javascript pom, which certainly
does not load/include the Scala interpreter ...

The interpreter, ready-to-run, does not necessairily show in the web
console. Rather it is the fact, that the interpreter is registered by
the ScriptManager.

I suggest you start committing what you have to the google code project
such that we could be of better help.

Regards
Felix

Am Dienstag, den 03.06.2008, 19:29 +0530 schrieb janandith jayawardena:
> Hi,
> 
> I think the reason is because the scala library which contains the
> interpreter is not correctly loading for the script to run.
> 
> 
> This is because in the launchpad I don't see the scala.tools.nsc library
> loaded.
> 
> I can only see the following,
> 
> "imported Packagesjavax.script,version=0.0.0 from System Bundle (0)
> org.apache.sling.scripting.api,version=2.0.0.incubator-SNAPSHOT from
> org.apache.sling.scripting.api (3)"
> 
> 
> I guess my maven configuration is not correct. What is the correct way to
> add a dependancy to load in sling.
> 
> The pom.xml I created is as follows, Apart from this I added the path to the
> source folder in the pom.xml file found in sling main directory. please
> point out any error I've done.
> 
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
> http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
> 
>     <modelVersion>4.0.0</modelVersion>
>     <parent>
>         <groupId>org.apache.sling</groupId>
>         <artifactId>sling</artifactId>
>         <version>1-incubator-SNAPSHOT</version>
>         <relativePath>../../parent/pom.xml</relativePath>
>     </parent>
> 
>     <artifactId>org.apache.sling.scripting.javascript</artifactId>
>     <version>2.0.0-incubator-SNAPSHOT</version>
>     <packaging>bundle</packaging>
> 
>     <name>Sling - Scripting - JavaScript Support</name>
>     <description>Support for JavaScript scripting</description>
> 
>     <scm>
>         <connection>
>             scm:svn:
> http://svn.apache.org/repos/asf/incubator/sling/trunk/scripting/javascript
>         </connection>
>         <developerConnection>
>             scm:svn:
> https://svn.apache.org/repos/asf/incubator/sling/trunk/scripting/javascript
>         </developerConnection>
>         <url>
> 
> http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/javascript
>         </url>
>     </scm>
> 
>     <build>
>         <plugins>
>             <plugin>
>                 <groupId>org.apache.felix</groupId>
>                 <artifactId>maven-scr-plugin</artifactId>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.felix</groupId>
>                 <artifactId>maven-bundle-plugin</artifactId>
>                 <extensions>true</extensions>
>                 <configuration>
>                     <instructions>
>                         <Private-Package>
>                             org.apache.sling.scripting.javascript.*,
>                             org.mozilla.classfile,
>                             !org.mozilla.javascript.xml.impl.xmlbeans,
>                             org.mozilla.javascript.*
>                         </Private-Package>
>                         <DynamicImport-Package>*</DynamicImport-Package>
>                         <ScriptEngine-Name>${pom.name}</ScriptEngine-Name>
> 
> <ScriptEngine-Version>${pom.version}</ScriptEngine-Version>
>                     </instructions>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
> 
>     <dependencies>
>         <dependency>
>             <groupId>org.apache.sling</groupId>
>             <artifactId>org.apache.sling.api</artifactId>
>             <version>2.0.0-incubator-SNAPSHOT</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.sling</groupId>
>             <artifactId>org.apache.sling.scripting.api</artifactId>
>             <version>2.0.0-incubator-SNAPSHOT</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.sling</groupId>
>             <artifactId>org.apache.sling.jcr.resource</artifactId>
>             <version>2.0.0-incubator-SNAPSHOT</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.sling</groupId>
>             <artifactId>org.apache.sling.commons.testing</artifactId>
>             <version>2.0.0-incubator-SNAPSHOT</version>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.jackrabbit</groupId>
>             <artifactId>jackrabbit-core</artifactId>
>             <scope>test</scope>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.sling</groupId>
>             <artifactId>org.apache.sling.commons.json</artifactId>
>             <version>2.0.0-incubator-SNAPSHOT</version>
>         </dependency>
>         <dependency>
>             <groupId>javax.servlet</groupId>
>             <artifactId>servlet-api</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>javax.jcr</groupId>
>             <artifactId>jcr</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>rhino</groupId>
>             <artifactId>js</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.slf4j</groupId>
>             <artifactId>slf4j-api</artifactId>
>         </dependency>
>         <!-- Testing -->
>         <dependency>
>             <groupId>junit</groupId>
>             <artifactId>junit</artifactId>
>         </dependency>
>         <dependency>
>             <groupId>org.slf4j</groupId>
>             <artifactId>slf4j-simple</artifactId>
>             <scope>test</scope>
>         </dependency>
>     </dependencies>
> </project>
> 
> thanks,
> janandith