Quantcast

Gradle equivalent for Maven -

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Gradle equivalent for Maven -

contactreji
This post has NOT been accepted by the mailing list yet.
Hi

I am using gradle to build the fat Jar for a camel application. When i execute it, I get following error. I have added all required dependencies corresponding to this namespace handler.

Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinit
ionParsingException: Configuration problem: Unable to locate Spring NamespaceHan
dler for XML schema namespace [http://www.springframework.org/schema/context]
Offending resource: class path resource [META-INF/spring/camel-context.xml]

        at org.springframework.beans.factory.parsing.FailFastProblemReporter.err
or(FailFastProblemReporter.java:70)
        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderC
ontext.java:85)
        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderC



In maven , I used to get the same error but I applied the fix by adding following lines which are in Bold.

<plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-shade-plugin</artifactId>
                                <version>2.4.1</version>
                                <executions>
                                        <execution>
                                                <phase>package</phase>
                                                <goals>
                                                        <goal>shade</goal>
                                                </goals>
                                                <configuration>
                                                        <transformers>
                                                                <transformer
                                                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                                                        <mainClass>com.eap.vmm.vendor.MainRunnerVendor</mainClass>
                                                                </transformer>
                                                                 <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/spring.handlers</resource>
                                </transformer>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/spring.schemas</resource>
                                </transformer>

                                                        </transformers>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>


Is there a equivalent configuration in Gradle which I can put into my gradle task. Following gradle task creates my uber jar..


task fatJar(type: Jar) {
    baseName = project.name + '-all'
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } {
        exclude "META-INF/*.SF"
        exclude "META-INF/*.DSA"
        exclude "META-INF/*.RSA"
    }

    with jar
    manifest {
        attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': version
        attributes 'Main-Class': 'com.groovy.ApplicationBoot'
    }
}
Loading...