unable to find schemalocation when building with maven - maven

I am trying to build an project which contains wsdl and xsd with maven.
when I am building it i am getting
[ERROR] Failed to execute goal org.codehaus.mojo:axistools-maven-plugin:1.4:wsdl2java (default) on project (project_name)
Error generating Java code from WSDL. Error running Axis: C:\(project_name)\src\main\resource\xsd\schema.xsd (The system cannot find the file specified) -> [Help 1]
my schema.xsd present in src\main\resource\nms\xsd\schema.xsd
my schema.wsdl present in src\main\resource\nms\wsdl\schema.wsdl
in schema.wsdl schemaLocation is
<xsd:import namespace="nms" schemaLocation="../xsd/schema.xsd"/>
according to wsdl xsd is present in right location but axis2 tool searching it in different folder.
Provide me some help, Thank you.
maven wsdl2java configuration
<dependency>
<groupId>axis</groupId>
<artifactId>axis-wsdl4j</artifactId>
<version>1.5.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.5.1</version>
<scope>provided</scope>
</dependency>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<verbose>false</verbose>
<sourceDirectory>src/main/resources/</sourceDirectory>
<wsdlFiles>
<wsdlFile>schema.wsdl</wsdlFile>
</wsdlFiles>
</configuration>
<executions>
<execution>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>

Related

In STS - The type groovy.transform.Generated cannot be resolved. It is indirectly referenced from required .class files

I am trying to use spock framework in STS. But I am facing this error in my groovy class.
ERROR - The type groovy.transform.Generated cannot be resolved. It is indirectly referenced from required .class files
let me know, how to fix this issue.
Having this depedencies and plugin in pom.xml
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>2.1-M2-groovy-3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-spring</artifactId>
<version>2.1-M2-groovy-3.0</version>
<scope>test</scope>
</dependency>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.13.1</version>
<executions>
<execution>
<goals>
<goal>compileTests</goal>
</goals>
</execution>
</executions>
</plugin>
Downloaded the groovy plugin from Eclipse marketplace
This is the Groovy complier version

maven Error creating shaded jar: error in opening zip file

I am trying to build my dropwizard project using the following command :
mvn package
I am getting the following error :
Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.3:shade (default) on project rest-api: Error creating shaded jar: error in opening zip file /Users/ldelaney/.m2/repository/mysql/mysql-connector-java/5.1.36/mysql-connector-java-5.1.36.jar
I have checked, the jar is there, right where maven is looking.
I have also tried blowing it away, and running :
mvn clean
mvn package
But the error just will not go away. My IDE is not showing me any errors.
Also, here is my dependency in the POM :
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.36</version>
</dependency>
Here is the entire POM file.
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company.test</groupId>
<artifactId>rest-api</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<dropwizard.version>1.0.5</dropwizard.version>
<mongodriver.version>3.4.2</mongodriver.version>
<mysqlConnector.version>5.1.36</mysqlConnector.version>
<log4j.version>1.2.17</log4j.version>
</properties>
<dependencies>
<!-- Drop Wizard -->
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-auth</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-db</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-hibernate</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<!-- MYSQL and Hibernate -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysqlConnector.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.193</version>
</dependency>
<!-- Log4j dependencies -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>application.ServerApplication</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
Anyone have any ideas?
From the OP response, it looks like in .m2/repository/mysql-connector-java/5.1.36 there is only pom.xml file. Please do the following,
if you are using either nexus or artifactory repositories in your organization. delete mysql-connector coordinates and corresponding pom.xml file.
Ensure that your firewall is configured such that you can download file from here. Central repository is by default configured with maven installation.
Upgrade to maven 3 if you are on maven 2.
I just copied your pom and i was able to successfully build. I have no artifactory or nexus as well. Could you try following,
Go to your maven installation and specify a different repository location. You should go to /conf/settings.xml and uncomment and change <localRepository>/path/to/local/repo</localRepository> to a path. Make sure you do chmod +777 to that path.
If the problem persists, then manually download mysql-connector-java-5.1.36.jar and place it there. See if it works.
if 2 does not work, then try step 2 again but run mvn with -o flag. This is offline flag and maven will not download dependency.
If it does not work, can you show your maven output with -X flag,
mvn -U -X -e install
Is had this issue: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.1:shade (default) on project xxx: Error creating shaded jar: error in opening zip file /Users/username/.m2/repository/org/codehaus/groovy/groovy/2.2.0/groovy-2.2.0.jar -> [Help 1]
Resolution was rm -rf /Users/username/.m2/repository/org/codehaus/groovy/groovy/2.2.0 then it redownloaded it and started working again. If that helps.

Dependency convergence error

After updating Firefox I changed versions of libraries to higher ones. Following errors appeard:
[ERROR] Dependency convergence error for commons-collections:commons-collections:3.2.2 paths to dependency are:
[ERROR] +-net:serenity.pom.gradle:0.0.1-SNAPSHOT
[ERROR] +-net.serenity-bdd:serenity-core:1.1.29-rc.3
[ERROR] +-org.seleniumhq.selenium:htmlunit-driver:2.20
[ERROR] +-commons-collections:commons-collections:3.2.2
[ERROR] and
[ERROR] +-net:serenity.pom.gradle:0.0.1-SNAPSHOT
[ERROR] +-net.serenity-bdd:serenity-core:1.1.29-rc.3
[ERROR] +-io.appium:java-client:3.3.0
[ERROR] +-commons-validator:commons-validator:1.4.1
[ERROR] +-commons-collections:commons-collections:3.2.1
[ERROR] and
[ERROR] +-net:serenity.pom.gradle:0.0.1-SNAPSHOT
[ERROR] +-net.serenity-bdd:serenity-core:1.1.29-rc.3
[ERROR] +-commons-collections:commons-collections:3.2.2
[ERROR] ]
[ERROR] -> [Help 1]
Dependency tree looks like:
[INFO] +- net.serenity-bdd:serenity-core:jar:1.1.29-rc.3:test
[INFO] | +- org.seleniumhq.selenium:htmlunit-driver:jar:2.20:test
[INFO] | +- commons-collections:commons-collections:jar:3.2.2:test
[INFO] | +- io.appium:java-client:jar:3.3.0:test
[INFO] | | \- commons-validator:commons-validator:jar:1.4.1:test
[INFO] | | +- commons-beanutils:commons-beanutils:jar:1.8.3:test
[INFO] | | \- commons-digester:commons-digester:jar:1.8.1:test
How to solve this problem?
Can I manually switch the library?
PS
Here is my pom.xml
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>1.1.29-rc.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-jbehave</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.2.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>verify</id>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<inherited>true</inherited>
</execution>
</executions>
<configuration>
<failFast>true</failFast>
<rules>
<DependencyConvergence></DependencyConvergence>
<requireReleaseDeps>
<onlyWhenRelease>true</onlyWhenRelease>
</requireReleaseDeps>
<requireJavaVersion>
<version>${java.version}</version>
</requireJavaVersion>
</rules>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18</version>
<configuration>
<includes>
<include>src/test/java/*.java </include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>1.1.29-rc.1</version>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>1.1.29-rc.3</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
See POM Reference, Exclusions:
Exclusions explicitly tell Maven that you don't want to include the specified project that is a dependency of this dependency (in other words, its transitive dependency).
See also Apache Maven Enforcer Rules, Dependency Convergence:
If a project has two dependencies, A and B, both depending on the same artifact, C, this rule will fail the build if A depends on a different version of C then the version of C depended on by B.
[...]
And this will succeed.
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.6.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
I know I'm late to the party, but after scratching my head for 8-10 hours, I came around this solution which fixes the problem when you don't have control over different poms where the different versions of dependencies are used at different places. So, I thought it's worth sharing.
#Gerold's answer is an ideal one (source: Maven wiki). But, it works for the case when you are the owner of all the dependencies and have the time, luxury and write permission to fix the issue at the root. In my case, I was using a company-wide global parent pom which had different versions set in different places, so I was facing this issue. I wanted to find some way to fix this on my end without changing the global parent pom.
To fix this, in your project's parent pom, you can specify the exact version which matches with rest of the places and override the versions specified by the global parent poms at different places. You can add this block in your project's parent pom
<!-- ============================= -->
<!-- DEPENDENCY MANAGEMENT -->
<!-- ============================= -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<!-- This version should be consistent
with versions at other places -->
<version>3.2.2</version>
</dependency>
</dependencies>
</dependencyManagement>
HTH
Or just remove the maven enforcer all together if you really/temporarily need to get past this issue.

How can I compile and run my Custom Doclet class in my project?

I'm trying to dump all class javadoc comment (preferabbly subclasses of a libraries WebPage class) at compile time into a .properties file in the format classname=comment.
So far I have:
created doclet class SiteMapDoclet
the class is defined to scan all the javadocs in the project and dump them to a .properties file
Added the necessary configs to my pom.xml for it to work.
Versions: Java 1.6.0.21, Maven 2.2.1
Problem:
mvn site returns:
Embedded error: Error rendering Maven report:
Exit code: 1 - java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at us.ak.state.revenue.cssd.Personnel.utils.SiteMapDoclet.<clinit>(SiteMapDoclet.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
I tried setting the jars as AdditionalDependencies even though they are normal dependencies for my project.
I also tried adding the paths to the jars I expect my class to need as part of the bootclasspath.
the reporting section of my pom.xml looks like this:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<reportSets>
<reportSet>
<id>html</id>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
<reportSet>
<id>siteMap</id>
<configuration>
<doclet>
us.ak.state.revenue.cssd.Personnel.utils.SiteMapDoclet
</doclet>
<docletPath>${project.build.outputDirectory}</docletPath>
<destDir>SiteMap</destDir>
<author>false</author>
<useStandardDocletOptions>false</useStandardDocletOptions>
<!-- there has got to be a better way to do this! -->
<!-- how can I fix the CSSD-Web - Base to use a proper manifest file? -->
<bootclasspath>
${bootClassPath};
${env.CLASSPATH};
${m2Repository}/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar;
${m2Repository}/org/apache/wicket/wicket-core/${wicket.version}/wicket-core-${wicket.version}.jar;
${m2Repository}/us/ak/state/revenue/cssd/CSSD-Web/${CSSDWebBase.version}/CSSD-Web-${CSSDWebBase.version}.jar
</bootclasspath>
<additionalDependencies>
<additionalDependency>
<groupId>us.ak.state.revenue.cssd</groupId>
<artifactId>CSSD-Web</artifactId>
<version>${CSSDWebBase.version}</version>
</additionalDependency>
<additionalDependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-core</artifactId>
<version>${wicket.version}</version>
</additionalDependency>
<additionalDependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</additionalDependency>
<additionalDependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</additionalDependency>
</additionalDependencies>
<name>SiteMapDoclet</name>
<description>Page Descriptions for SiteMap generation</description>
</configuration>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
NOTE:
${m2Repository} is defined as a property higher up the file,
defined as ${env.USERPROFILE}/.m2/repository
${bootClassPath} is defined as a property higher up the file,
defined as ${env.JRE_6_HOME}\lib\rt.jar;${env.JAVA_HOME}\lib\tools.jar;
How can i fix the NoClassDefFoundError?
Additionally I would like my SiteMap file to run as a part of the normal build process,
after compile but before package.
I've tried defining this in build, but the javadoc doesn't get created and I don't see any logging output from my Doclet.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>build-siteMap-Descriptions</id>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
UPDATE:
Thanks to #ben75 's suggestion. I've removed the <reporting> section of my pom.xml and now have the process failing during build. I added <goals> and copied the <configuration> section from <reporting>.
It's still throwing the NoClassDefFoundError but it's happening on build where I want it to. I tried adding:
<includeDependencySources>true</includeDependencySources>
<dependencySourceIncludes>
<dependencySourceInclude>org.apache.wicket:wicket-core:*</dependencySourceInclude>
<dependencySourceInclude>org.apache.commons.logging:*</dependencySourceInclude>
<dependencySourceInclude>us.ak.state.revenue.cssd:CSSD-Web:*</dependencySourceInclude>
</dependencySourceIncludes>
To the configuration section, but that didn't work.
You can try to put your <additionalDependencies> as plugin dependendencies:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<dependencies>
<dependency>
<groupId>us.ak.state.revenue.cssd</groupId>
<artifactId>CSSD-Web</artifactId>
<version>${CSSDWebBase.version}</version>
</dependency>
...
To attach javadoc plugin to your normal build process, I think you just need to specify the goal and preferably attaching it to prepare-package phase (so that javadoc is not generated when you simply run the test phase):
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>attach-javadoc</id>
<phase>prepare-package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Building upon #ben75s Excellent Advice I was able to get it to finally run.
This "works". It feels wrong and I'd love to see a better method.
Here's what I did:
Defined the plugin in the build section with the javadoc goal.
made sure tools.jar and rt.jar are in the <bootclasspath>
defined the <docletPath> as \;.;${project.build.outputDirectory};
the \;.; are necessary because maven doesn't append correctly
also had to explicitly add the path to some of the packages here to prevent inheritence of conflicting versions. (Specifically of Log4J)
defined <docletArtifacts> with the packages for the classes throwing the NoClassDefFoundError
My plugin now looks like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>build-siteMap-Descriptions</id>
<phase>process-classes</phase>
<goals>
<!--<goal>aggregate</goal>-->
<goal>javadoc</goal>
</goals>
<configuration>
<doclet>
us.ak.state.revenue.cssd.Personnel.utils.SiteMapDoclet
</doclet>
<!-- the initial '\;.;' is required
because maven doesn't separate the path statements properly
The 5 packages are necessary
because otherwise slf4j complains about multiple bindings
-->
<docletPath>
\;.;${project.build.outputDirectory};
${m2Repository}/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar;
${m2Repository}/log4j/log4j/1.2.16/log4j-1.2.16.jar;
${m2Repository}/log4j/apache-log4j-extras/1.1/apache-log4j-extras-1.1.jar;
${m2Repository}/us/ak/state/revenue/cssd/CSSD-Web/${CSSDWebBase.version}/CSSD-Web-${CSSDWebBase.version}.jar;
${m2Repository}/org/apache/wicket/wicket-core/${wicket.version}/wicket-core-${wicket.version}.jar;
${m2Repository}/org/apache/wicket/wicket-util/${wicket.version}/wicket-util-${wicket.version}.jar;
</docletPath>
<docletArtifacts>
<!--
<docletArtifact>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</docletArtifact>
-->
<docletArtifact>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.2</version>
</docletArtifact>
<!-- how do I fix the download errors? -->
<!--
<docletArtifact>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.2</version>
</docletArtifact>
-->
<!--
<artifact>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</artifact>
-->
<!--
<docletArtifact>
<groupId>log4j</groupId>
<artifactId>apache-log4j-extras</artifactId>
<version>1.1</version>
</docletArtifact>
<docletArtifact>
<groupId>us.ak.state.revenue.cssd</groupId>
<artifactId>CSSD-Web</artifactId>
<version>${CSSDWebBase.version}</version>
</docletArtifact>
<docletArtifact>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-core</artifactId>
<version>${wicket.version}</version>
</docletArtifact>
-->
</docletArtifacts>
<!-- the initial '\;.;' is required
because maven doesn't separate the path statements properly -->
<bootclasspath>
\;.;
${bootClassPath};
${env.CLASSPATH};
</bootclasspath>
<destDir>SiteMap</destDir>
<author>false</author>
<!-- don't print the packages/classes it's running on -->
<quiet>true</quiet>
<debug>true</debug> <!-- save options -->
<useStandardDocletOptions>false</useStandardDocletOptions>
<name>SiteMapDoclet</name>
<description>Page Descriptions for SiteMap generation</description>
</configuration>
</execution>
</executions>
</plugin>

how to exclude GWT dependency code from OSGI bundle generated by MAven+BND?

I have several Maven modules with Vaadin library dependency in the root pom.xml file.
I'm trying to build a set of OSGI bundles (1 per Maven module) using Maven+BND.
I added this to my "root" pom.xml file:
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>6.6.6</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
unfortunately, the resulting JAR files (bundles) include GWT (com.google.gwt) classes. This
1) makes the bundles huge, with lots of duplicated dependencies.
2) generated thousands of build warnings about "split packages".
QUESTION: how to prevent adding GWT classes into my Jar files?
I tried setting "scope" of GWT to "provided", setting "type" to "bundle", and even optional=true - didn't help.
here's the part of my root pom.xml, which is responsible for Vaadin/GWT stuff:
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>mycompany.*</Export-Package>
<Private-Package>*.impl.*</Private-Package>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<!-- <Bundle-Activator>com.alskor.publicpackage.MyActivator</Bundle-Activator>-->
</instructions>
</configuration>
</plugin>
<!-- Compiles your custom GWT components with the GWT compiler -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<!-- Version 2.1.0-1 works at least with Vaadin 6.5 -->
<version>2.3.0-1</version>
<configuration>
<!-- if you don't specify any modules, the plugin will find them -->
<!--modules>
..
</modules-->
<webappDirectory>${project.build.directory}/${project.build.finalName}/VAADIN/widgetsets
</webappDirectory>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<runTarget>clean</runTarget>
<hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
<noServer>true</noServer>
<port>8080</port>
</configuration>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Updates Vaadin 6.2+ widgetset definitions based on project dependencies -->
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<configuration>
<!-- if you don't specify any modules, the plugin will find them -->
<!--
<modules>
<module>${package}.gwt.MyWidgetSet</module>
</modules>
-->
</configuration>
<goals>
<goal>update-widgetset</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
The wildcards in your Export-Package and Private-Package statements strike me as exceedingly dangerous. It's possible that the GWT packages are being dragged in because of the *.impl.* pattern in Private-Package.
Also you should never use wildcards in Export-Package: exports should be tightly controlled and versioned.
use mvn dependency:tree to see where the gwt dependency comes from
Add an <excludes/> element with an appropriate <exclude/> to the dependency in question to suppress it.
I've had similar problem, as final war file exceeded almost 90MB !
One of the culprit was aforementioned jar, so I did this :
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>widgetset</artifactId>
<version>3.2</version>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.gwt</groupId>
<artifactId>gwt-user</artifactId>
</exclusion>
</exclusions>
</dependency>
...
</dependencies>

Resources