You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Alexey Zavizionov <al...@gmail.com> on 2008/10/28 17:07:41 UTC

Re: Bundling ASM in CXF

Hello, list!

How ans where can I build CXF big bundled jar, which would include asm classes?

Regards,
Alexey

Re: Bundling ASM in CXF

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 28 October 2008 12:07:41 pm Alexey Zavizionov wrote:
> Hello, list!
>
> How ans where can I build CXF big bundled jar, which would include asm
> classes?
>
> Regards,
> Alexey

The BEST way to do this is to take our pom for the bundle jar:
http://svn.apache.org/repos/asf/cxf/trunk/distribution/bundle/all/pom.xml

and update the configuration for the shade plugin to add a "relocations" 
configuration.    See the second example at:
http://maven.apache.org/plugins/maven-shade-plugin/examples.html


You can also remove some of the deps from the pom if you don't need them to 
reduce the size a bit.   For example, if you don't need jms, remove it.    If 
you don't need some of the javascript stuff or xmlbeans or similar, remove 
them.


-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: Bundling ASM in CXF

Posted by Daniel Kulp <dk...@apache.org>.
The BIGGEST problem with this is that it doesn't work well with eclipse at 
all.  The "cxf-util-asm" modules wouldn't have any source in it, so eclipse 
wouldn't compile anything and such and thus, none of the remapped classes 
would be available for the other modules to use.    That's the major issue I 
have with it.   If it breaks eclipse, that's a huge issue.  That's why doing 
it at bundle time is "easy" as that's after eclipse is done with it.

The licensing is OK.   We would just need to make sure the META-INF/LICENSE 
and META-INF/NOTICE and such is all OK, but we have to do that anyway.

Dan


On Wednesday 29 October 2008 9:01:23 am Ian Roberts wrote:
> Willem Jiang wrote:
> > I just wrote a pom.xml which leverage the shade plugin to  bundle ASM in
> > CXF. It may help to you.
>
> Willem,
>
> I've just done a quick grep through the CXF code and I've noticed that
> besides the hard dependencies (import org.objectweb.asm...) there's one
> place (line 240 of org.apache.cxf.jaxws.interceptors.WrapperHelper in
> rt/frontend/jaxws) where CXF tries to load an ASM class by
> Class.forName.  Is this something the shade plugin can cope with or does
> that need another approach?
>
> Given the headaches that mismatched ASM versions can cause I'd certainly
> be keen on the idea of using the relocated ASM in CXF by default.  Maybe
> have a new module in the CXF tree that just builds a relocated ASM jar
> and deploys that to your local repository as (say) cxf-util-asm.  Then
> have the other modules depend on that rather than the original ASM and
> use the relocated package names explicitly in the code [I'm not a maven
> expert so please excuse me if I've mis-used some standard terms].
>
> What do people think of that idea?  One issue might be how does it
> interact with the Apache licensing?  Can one deploy a relocated ASM to
> the apache maven repo?  For reference the ASM licence is
> http://asm.objectweb.org/license.html.
>
> Ian



-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: Bundling ASM in CXF

Posted by Alexey Zavizionov <al...@gmail.com>.
Thanks Willem, I will try it.

On Wed, Oct 29, 2008 at 10:20 AM, Willem Jiang <wi...@gmail.com> wrote:
> Hi Alexey,
>
> I just wrote a pom.xml which leverage the shade plugin to  bundle ASM in
> CXF. It may help to you.
>
> Willem
>
> <?xml version="1.0"?>
> <!--
>  Licensed to the Apache Software Foundation (ASF) under one
>  or more contributor license agreements. See the NOTICE file
>  distributed with this work for additional information
>  regarding copyright ownership. The ASF licenses this file
>  to you under the Apache License, Version 2.0 (the
>  "License"); you may not use this file except in compliance
>  with the License. You may obtain a copy of the License at
>
>  http://www.apache.org/licenses/LICENSE-2.0
>
>  Unless required by applicable law or agreed to in writing,
>  software distributed under the License is distributed on an
>  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>  KIND, either express or implied. See the License for the
>  specific language governing permissions and limitations
>  under the License.
> -->
> <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>
>    <groupId>org.apache.cxf</groupId>
>    <artifactId>cxf-bundle-with-asm</artifactId>
>    <packaging>bundle</packaging>
>    <name>Apache CXF Bundle Jar</name>
>    <version>2.1.3</version>
>    <url>http://cxf.apache.org</url>
>
>    <parent>
>        <groupId>org.apache.cxf</groupId>
>        <artifactId>cxf-bundle-parent</artifactId>
>        <version>2.1.3</version>
>    </parent>
>
>    <dependencies>
>        <dependency>
>            <groupId>${pom.groupId}</groupId>
>            <artifactId>cxf-bundle</artifactId>
>            <version>${pom.version}</version>
>        </dependency>
>        <dependency>
>            <groupId>asm</groupId>
>            <artifactId>asm</artifactId>
>        </dependency>
>    </dependencies>
>
>    <build>
>        <plugins>
>            <plugin>
>                <groupId>org.apache.felix</groupId>
>                <artifactId>maven-bundle-plugin</artifactId>
>                <extensions>true</extensions>
>                <configuration>
>                    <instructions>
>                        <Implementation-Title>Apache
> CXF</Implementation-Title>
>                        <Implementation-Vendor>The Apache Software
> Foundation</Implementation-Vendor>
>
> <Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
>
> <Implementation-Version>${pom.version}</Implementation-Version>
>                        <Specification-Title>Apache
> CXF</Specification-Title>
>                        <Specification-Vendor>The Apache Software
> Foundation</Specification-Vendor>
>
> <Specification-Version>${pom.version}</Specification-Version>
>                        <DynamicImport-Package>
>                            com.ctc.wstx.*
>                        </DynamicImport-Package>
>                        <Import-Package>
>                            antlr*;resolution:=optional,
>                            com.ibm*;resolution:=optional,
>                            com.sun*;resolution:=optional,
>                            javax.jms*;resolution:=optional,
>                            javax.ws.rs*;resolution:=optional,
>                            repackage;resolution:=optional,
>                            javax.resource.spi*;resolution:=optional,
>                            javax.xml.soap,
>                            junit.framework*;resolution:=optional,
>                            org.apache.abdera*;resolution:=optional,
>                            org.apache.commons.lang*;resolution:=optional,
>                            org.apache.commons.codec*;resolution:=optional,
>                            org.apache.log4j*;resolution:=optional,
>                            org.apache.velocity*;resolution:=optional,
>                            org.apache.xmlbeans*;resolution:=optional,
>                            org.apache.ws.security*;resolution:=optional,
>                            org.codehaus.jra*;resolution:=optional,
>                            org.codehaus.jettison*;resolution:=optional,
>                            org.jaxen*;resolution:=optional,
>                            org.jdom*;resolution:=optional,
>                            org.junit*;resolution:=optional,
>                            org.mortbay*;resolution:=optional,
>                            org.mozilla.javascript*;resolution:=optional,
>                            org.springframework*;resolution:=optional,
>                            *
>                        </Import-Package>
>                        <Export-Package>
>
> org.apache.cxf.*;version=${pom.version};-split-package:=merge-first,
>                            org.codehaus.xfire.aegis.type.java5.*,
>                            '=META-INF.cxf'
>                        </Export-Package>
>                        <_failok>true</_failok>
>                    </instructions>
>                </configuration>
>            </plugin>
>            <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-shade-plugin</artifactId>
>                <version>1.1</version>
>                <executions>
>                    <execution>
>                        <phase>package</phase>
>                        <goals>
>                            <goal>shade</goal>
>                        </goals>
>                        <configuration>
>                            <artifactSet>
>                              <includes>
>
> <include>org.apache.cxf:cxf-bundle</include>
>                                 <include>asm:asm</include>
>
>                              </includes>
>                            </artifactSet>
>                            <filters>
>                                <filter>
>
> <artifact>${project.groupId}:${project.artifactId}</artifact>
>                                    <excludes>
>                                        <exclude>org/**</exclude>
>                                    </excludes>
>                                </filter>
>                            </filters>
>
>                            <relocations>
>                              <relocation>
>                                 <pattern>org.objectweb.asm</pattern>
>
> <shadedPattern>org.apache.cxf.asm</shadedPattern>
>
>                              </relocation>
>                            </relocations>
>                        </configuration>
>                    </execution>
>                </executions>
>                <dependencies>
>                    <dependency>
>                        <groupId>${pom.groupId}</groupId>
>                        <artifactId>cxf-buildtools</artifactId>
>                        <version>${pom.version}</version>
>                    </dependency>
>                </dependencies>
>            </plugin>
>        </plugins>
>    </build>
>
> </project>
>
>
>
> Alexey Zavizionov wrote:
>> Thanks for the reply,
>>
>> With the same rules file I have "Syntax error: Duplicate jar entries:
>> org/exo/asm/*.class"
>>
>> Without asterisk in it
>> $ cat rulesfile
>> rule org.objectweb.asm org.exo.asm
>> I have as a  result replaced classes to the old structure with an
>> empty folder org/exo/asm :(
>>
>> Regards,
>> Alexey.
>>
>> On Tue, Oct 28, 2008 at 6:55 PM, Ian Roberts <i....@dcs.shef.ac.uk> wrote:
>>> Alexey Zavizionov wrote:
>>>> At least, I have used the jarjar... and it works! Thanks to Ian and Guillaume
>>>> $ java -jar jarjar.jar process rulesfile
>>>> cxf-common-utilities-2.1.2.jar cxf-common-utilities-2.1.2-new.jar
>>>> $ cat rulesfile
>>>> rule org.objectweb.asm.* org.exo.asm.*
>>>>
>>>> Than, I have renamed folder within lib/apps/asm-2.2.3.jar according to
>>>> new package name.
>>> That won't be sufficient on its own - you'll have to jarjar the asm JAR
>>> as well in order to change any internal references among the ASM classes
>>> to use the new package name.  Just use the same jarjar rules file to
>>> process the ASM jar as you used for the cxf one.
>>>
>>> Ian
>>>
>>> --
>>> Ian Roberts               | Department of Computer Science
>>> i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK
>>>
>>
>
>

Re: Bundling ASM in CXF

Posted by Daniel Kulp <dk...@apache.org>.
Or if Class.forName("org.objectweb.asm.ClassWriter") fails, then also check 
for Class.forName("org.apache.cxf.asm.ClassWriter") or whatever the shaded 
name is. 

:-)

Dan

On Thursday 30 October 2008 7:41:15 am Ian Roberts wrote:
> Willem Jiang wrote:
> > Hi Ian,
> >
> > I went through the WrapperHelper that you show me. I think the code just
> >   works as button which enables of disables the WrapperHelperCompiler.
> > The WrapperHelperCompiler uses the ASM with the hard dependencies and
> > maven shade plugin will take care of it.
>
> But if the Class.forName("org.objectweb.asm.ClassWriter") fails with a
> ClassNotFoundException - which it will do if you don't have a "real" ASM
> in the normal package on your classpath - then WrapperHelperCompiler
> doesn't get called at all and according to the comment it'll "just use
> reflection based stuff".  As far as I can see, the only way round this
> is to change the class name parameter of the forName call to match the
> shaded package.
>
> There's probably some clever hoops we can jump through, e.g. loading the
> class name from some file in META-INF, and then replacing that file in
> the shaded version of the JAR, but that seems messier to me than just
> using the shaded ASM in the first place.
>
> I'll stop going on about this now, honest ;-)
>
> Ian



-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: Bundling ASM in CXF

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
Willem Jiang wrote:
> Hi Ian,
> 
> I went through the WrapperHelper that you show me. I think the code just
>   works as button which enables of disables the WrapperHelperCompiler.
> The WrapperHelperCompiler uses the ASM with the hard dependencies and
> maven shade plugin will take care of it.

But if the Class.forName("org.objectweb.asm.ClassWriter") fails with a
ClassNotFoundException - which it will do if you don't have a "real" ASM
in the normal package on your classpath - then WrapperHelperCompiler
doesn't get called at all and according to the comment it'll "just use
reflection based stuff".  As far as I can see, the only way round this
is to change the class name parameter of the forName call to match the
shaded package.

There's probably some clever hoops we can jump through, e.g. loading the
class name from some file in META-INF, and then replacing that file in
the shaded version of the JAR, but that seems messier to me than just
using the shaded ASM in the first place.

I'll stop going on about this now, honest ;-)

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK

Re: Bundling ASM in CXF

Posted by Willem Jiang <wi...@gmail.com>.
Hi Ian,

I went through the WrapperHelper that you show me. I think the code just
  works as button which enables of disables the WrapperHelperCompiler.
The WrapperHelperCompiler uses the ASM with the hard dependencies and
maven shade plugin will take care of it.

If you have a wrong version ASM for CXF in your class patch and you
can't endorse it with the CXF shipped version, you just need to use the
ASM relocated CXF bundler to go around it.

So I don't think it is necessary to add a cxf-util-asm into the our
maven repository.

Willem

Ian Roberts wrote:
> Willem Jiang wrote:
>> I just wrote a pom.xml which leverage the shade plugin to  bundle ASM in
>> CXF. It may help to you.
> 
> Willem,
> 
> I've just done a quick grep through the CXF code and I've noticed that
> besides the hard dependencies (import org.objectweb.asm...) there's one
> place (line 240 of org.apache.cxf.jaxws.interceptors.WrapperHelper in
> rt/frontend/jaxws) where CXF tries to load an ASM class by
> Class.forName.  Is this something the shade plugin can cope with or does
> that need another approach?
> 
> Given the headaches that mismatched ASM versions can cause I'd certainly
> be keen on the idea of using the relocated ASM in CXF by default.  Maybe
> have a new module in the CXF tree that just builds a relocated ASM jar
> and deploys that to your local repository as (say) cxf-util-asm.  Then
> have the other modules depend on that rather than the original ASM and
> use the relocated package names explicitly in the code [I'm not a maven
> expert so please excuse me if I've mis-used some standard terms].
> 
> What do people think of that idea?  One issue might be how does it
> interact with the Apache licensing?  Can one deploy a relocated ASM to
> the apache maven repo?  For reference the ASM licence is
> http://asm.objectweb.org/license.html.
> 
> Ian
> 


Re: Bundling ASM in CXF

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
Willem Jiang wrote:
> I just wrote a pom.xml which leverage the shade plugin to  bundle ASM in
> CXF. It may help to you.

Willem,

I've just done a quick grep through the CXF code and I've noticed that
besides the hard dependencies (import org.objectweb.asm...) there's one
place (line 240 of org.apache.cxf.jaxws.interceptors.WrapperHelper in
rt/frontend/jaxws) where CXF tries to load an ASM class by
Class.forName.  Is this something the shade plugin can cope with or does
that need another approach?

Given the headaches that mismatched ASM versions can cause I'd certainly
be keen on the idea of using the relocated ASM in CXF by default.  Maybe
have a new module in the CXF tree that just builds a relocated ASM jar
and deploys that to your local repository as (say) cxf-util-asm.  Then
have the other modules depend on that rather than the original ASM and
use the relocated package names explicitly in the code [I'm not a maven
expert so please excuse me if I've mis-used some standard terms].

What do people think of that idea?  One issue might be how does it
interact with the Apache licensing?  Can one deploy a relocated ASM to
the apache maven repo?  For reference the ASM licence is
http://asm.objectweb.org/license.html.

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK

Re: Bundling ASM in CXF

Posted by Willem Jiang <wi...@gmail.com>.
Hi Alexey,

I just wrote a pom.xml which leverage the shade plugin to  bundle ASM in
CXF. It may help to you.

Willem

<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements. See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership. The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License. You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied. See the License for the
  specific language governing permissions and limitations
  under the License.
-->
<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>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-bundle-with-asm</artifactId>
    <packaging>bundle</packaging>
    <name>Apache CXF Bundle Jar</name>
    <version>2.1.3</version>
    <url>http://cxf.apache.org</url>

    <parent>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-bundle-parent</artifactId>
        <version>2.1.3</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>${pom.groupId}</groupId>
            <artifactId>cxf-bundle</artifactId>
            <version>${pom.version}</version>
        </dependency>
        <dependency>
            <groupId>asm</groupId>
            <artifactId>asm</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Implementation-Title>Apache
CXF</Implementation-Title>
                        <Implementation-Vendor>The Apache Software
Foundation</Implementation-Vendor>

<Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>

<Implementation-Version>${pom.version}</Implementation-Version>
                        <Specification-Title>Apache
CXF</Specification-Title>
                        <Specification-Vendor>The Apache Software
Foundation</Specification-Vendor>

<Specification-Version>${pom.version}</Specification-Version>
                        <DynamicImport-Package>
                            com.ctc.wstx.*
                        </DynamicImport-Package>
                        <Import-Package>
                            antlr*;resolution:=optional,
                            com.ibm*;resolution:=optional,
                            com.sun*;resolution:=optional,
                            javax.jms*;resolution:=optional,
                            javax.ws.rs*;resolution:=optional,
                            repackage;resolution:=optional,
                            javax.resource.spi*;resolution:=optional,
                            javax.xml.soap,
                            junit.framework*;resolution:=optional,
                            org.apache.abdera*;resolution:=optional,
                            org.apache.commons.lang*;resolution:=optional,
                            org.apache.commons.codec*;resolution:=optional,
                            org.apache.log4j*;resolution:=optional,
                            org.apache.velocity*;resolution:=optional,
                            org.apache.xmlbeans*;resolution:=optional,
                            org.apache.ws.security*;resolution:=optional,
                            org.codehaus.jra*;resolution:=optional,
                            org.codehaus.jettison*;resolution:=optional,
                            org.jaxen*;resolution:=optional,
                            org.jdom*;resolution:=optional,
                            org.junit*;resolution:=optional,
                            org.mortbay*;resolution:=optional,
                            org.mozilla.javascript*;resolution:=optional,
                            org.springframework*;resolution:=optional,
                            *
                        </Import-Package>
                        <Export-Package>

org.apache.cxf.*;version=${pom.version};-split-package:=merge-first,
                            org.codehaus.xfire.aegis.type.java5.*,
                            '=META-INF.cxf'
                        </Export-Package>
                        <_failok>true</_failok>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <artifactSet>
                              <includes>

<include>org.apache.cxf:cxf-bundle</include>
                                 <include>asm:asm</include>

                              </includes>
                            </artifactSet>
                            <filters>
                                <filter>

<artifact>${project.groupId}:${project.artifactId}</artifact>
                                    <excludes>
                                        <exclude>org/**</exclude>
                                    </excludes>
                                </filter>
                            </filters>

                            <relocations>
                              <relocation>
                                 <pattern>org.objectweb.asm</pattern>

<shadedPattern>org.apache.cxf.asm</shadedPattern>

                              </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>${pom.groupId}</groupId>
                        <artifactId>cxf-buildtools</artifactId>
                        <version>${pom.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

</project>



Alexey Zavizionov wrote:
> Thanks for the reply,
> 
> With the same rules file I have "Syntax error: Duplicate jar entries:
> org/exo/asm/*.class"
> 
> Without asterisk in it
> $ cat rulesfile
> rule org.objectweb.asm org.exo.asm
> I have as a  result replaced classes to the old structure with an
> empty folder org/exo/asm :(
> 
> Regards,
> Alexey.
> 
> On Tue, Oct 28, 2008 at 6:55 PM, Ian Roberts <i....@dcs.shef.ac.uk> wrote:
>> Alexey Zavizionov wrote:
>>> At least, I have used the jarjar... and it works! Thanks to Ian and Guillaume
>>> $ java -jar jarjar.jar process rulesfile
>>> cxf-common-utilities-2.1.2.jar cxf-common-utilities-2.1.2-new.jar
>>> $ cat rulesfile
>>> rule org.objectweb.asm.* org.exo.asm.*
>>>
>>> Than, I have renamed folder within lib/apps/asm-2.2.3.jar according to
>>> new package name.
>> That won't be sufficient on its own - you'll have to jarjar the asm JAR
>> as well in order to change any internal references among the ASM classes
>> to use the new package name.  Just use the same jarjar rules file to
>> process the ASM jar as you used for the cxf one.
>>
>> Ian
>>
>> --
>> Ian Roberts               | Department of Computer Science
>> i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK
>>
> 


Re: Bundling ASM in CXF

Posted by Alexey Zavizionov <al...@gmail.com>.
Thanks for the reply,

With the same rules file I have "Syntax error: Duplicate jar entries:
org/exo/asm/*.class"

Without asterisk in it
$ cat rulesfile
rule org.objectweb.asm org.exo.asm
I have as a  result replaced classes to the old structure with an
empty folder org/exo/asm :(

Regards,
Alexey.

On Tue, Oct 28, 2008 at 6:55 PM, Ian Roberts <i....@dcs.shef.ac.uk> wrote:
> Alexey Zavizionov wrote:
>> At least, I have used the jarjar... and it works! Thanks to Ian and Guillaume
>> $ java -jar jarjar.jar process rulesfile
>> cxf-common-utilities-2.1.2.jar cxf-common-utilities-2.1.2-new.jar
>> $ cat rulesfile
>> rule org.objectweb.asm.* org.exo.asm.*
>>
>> Than, I have renamed folder within lib/apps/asm-2.2.3.jar according to
>> new package name.
>
> That won't be sufficient on its own - you'll have to jarjar the asm JAR
> as well in order to change any internal references among the ASM classes
> to use the new package name.  Just use the same jarjar rules file to
> process the ASM jar as you used for the cxf one.
>
> Ian
>
> --
> Ian Roberts               | Department of Computer Science
> i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK
>

Re: Bundling ASM in CXF

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
Alexey Zavizionov wrote:
> At least, I have used the jarjar... and it works! Thanks to Ian and Guillaume
> $ java -jar jarjar.jar process rulesfile
> cxf-common-utilities-2.1.2.jar cxf-common-utilities-2.1.2-new.jar
> $ cat rulesfile
> rule org.objectweb.asm.* org.exo.asm.*
> 
> Than, I have renamed folder within lib/apps/asm-2.2.3.jar according to
> new package name.

That won't be sufficient on its own - you'll have to jarjar the asm JAR
as well in order to change any internal references among the ASM classes
to use the new package name.  Just use the same jarjar rules file to
process the ASM jar as you used for the cxf one.

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK

Re: Bundling ASM in CXF

Posted by Alexey Zavizionov <al...@gmail.com>.
Hi all!

I have played with cxf-2.1.2/distribution/bundle/all/
to build asm into cxf-bundle-2.1.2.jar - (4M size ) without  success...
due to that plugin less documented.  :)

At least, I have used the jarjar... and it works! Thanks to Ian and Guillaume
$ java -jar jarjar.jar process rulesfile
cxf-common-utilities-2.1.2.jar cxf-common-utilities-2.1.2-new.jar
$ cat rulesfile
rule org.objectweb.asm.* org.exo.asm.*

Than, I have renamed folder within lib/apps/asm-2.2.3.jar according to
new package name.

Thanks and regards,
Alexey.

On Tue, Oct 28, 2008 at 6:32 PM, Daniel Kulp <dk...@apache.org> wrote:
> On Tuesday 28 October 2008 12:13:38 pm Andrew Clegg wrote:
>> You can use Maven's assembly plugin to suck all the dependencies for
>> your project into one jar, including CXF and all its dependencies, if
>> that helps:
>>
>> http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#
>>jar-with-dependencies
>
> That, in general, doesn't work well with CXF unless you depend on the
> cxf-bundle jar and not the individual modules.   There are files that needs
> to be merged together for it to work well.  (the spring.schemas,
> spring.handlers, cxf.extension, etc...)
>
> The maven shade plugin can be configured to properly handle all of that.
>
> Dan
>
>
>> I guess you could rebuild CXF from source this way if you just wanted
>> CXF itself + dependencies.
>>
>> However! Be warned it does end up fairly big:
>>
>> http://www.nabble.com/Streamlining-dependencies-for-distribution-td19990610
>>.html
>>
>> (No-one ever replied to that last one so I guess there's no easy way
>> round it...)
>>
>> Andrew.
>>
>> 2008/10/28 Alexey Zavizionov <al...@gmail.com>:
>> > Hello, list!
>> >
>> > How ans where can I build CXF big bundled jar, which would include asm
>> > classes?
>> >
>> > Regards,
>> > Alexey
>
>
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
>

Re: Bundling ASM in CXF

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 28 October 2008 12:13:38 pm Andrew Clegg wrote:
> You can use Maven's assembly plugin to suck all the dependencies for
> your project into one jar, including CXF and all its dependencies, if
> that helps:
>
> http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#
>jar-with-dependencies

That, in general, doesn't work well with CXF unless you depend on the 
cxf-bundle jar and not the individual modules.   There are files that needs 
to be merged together for it to work well.  (the spring.schemas, 
spring.handlers, cxf.extension, etc...)

The maven shade plugin can be configured to properly handle all of that.

Dan


> I guess you could rebuild CXF from source this way if you just wanted
> CXF itself + dependencies.
>
> However! Be warned it does end up fairly big:
>
> http://www.nabble.com/Streamlining-dependencies-for-distribution-td19990610
>.html
>
> (No-one ever replied to that last one so I guess there's no easy way
> round it...)
>
> Andrew.
>
> 2008/10/28 Alexey Zavizionov <al...@gmail.com>:
> > Hello, list!
> >
> > How ans where can I build CXF big bundled jar, which would include asm
> > classes?
> >
> > Regards,
> > Alexey



-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: Bundling ASM in CXF

Posted by Andrew Clegg <an...@gmail.com>.
You can use Maven's assembly plugin to suck all the dependencies for
your project into one jar, including CXF and all its dependencies, if
that helps:

http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#jar-with-dependencies

I guess you could rebuild CXF from source this way if you just wanted
CXF itself + dependencies.

However! Be warned it does end up fairly big:

http://www.nabble.com/Streamlining-dependencies-for-distribution-td19990610.html

(No-one ever replied to that last one so I guess there's no easy way
round it...)

Andrew.

2008/10/28 Alexey Zavizionov <al...@gmail.com>:
> Hello, list!
>
> How ans where can I build CXF big bundled jar, which would include asm classes?
>
> Regards,
> Alexey
>

Re: Bundling ASM in CXF

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
Alexey Zavizionov wrote:
> Hello, list!
> 
> How ans where can I build CXF big bundled jar, which would include asm classes?

You might be able to do it with JarJar Links
(http://code.google.com/p/jarjar).  It can move classes around into
different packages and rewrite the bytecodes of other classes to point
to the new locations, I've used it successfully to repackage ASM itself
into a different namespace for one of my own projects.

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK