How to stop maven from recompiling the widgetset whenever running.

Hi all,

     In my vaadin application i used refresher addon . If i change any source code , i need to clean and build the project in netbeans .
     Whenever i do this, the refresher widgetset compilng and linking.Actually i  create project using MAVEN . Please give the solution.

Thank you

Hi!

You have to comment out the relevant sections in pom:

com.vaadin

org.codehaus.mojo

We just started using the method described in
this blog
. It generates the widgetset into the source tree instead of the target tree, so the bits are always there and you can rebuild them if you need to (e.g. if you change the version of Refresher or Vaadin).

I think you could accomplish the same thing in a simpler way by just changing this one line in pom.xml:

<webappDirectory>src/main/webapp/VAADIN/widgetsets</webappDirectory>

I
think
that maven would automatically skip rebuilding the widgetset if it doesn’t need it. But I haven’t tested that fully yet. It’s probably worth the one-line change though.

Cheers,
Bobby

Hi sir ,
I have changed the directory like what you said but when i changed any source code and i clean and build and run the project , again
it will recompile the widgetset .

Please give some solution.

This is my Pom.xml


<?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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany</groupId>
  <artifactId>mymavenproject</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>ffccbw</name>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <vaadin.version>6.7.6</vaadin.version>
    <gwt.version>2.3.0</gwt.version>
    <gwt.plugin.version>2.2.0</gwt.plugin.version>
    <netbeans.hint.deploy.server>Tomcat</netbeans.hint.deploy.server>
  </properties>

  <build>
      
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>

      <!-- Compile custom GWT components or widget dependencies with the GWT compiler -->
      
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>${gwt.plugin.version}</version>
        <configuration>
          <webappDirectory>src/main/webapp/VAADIN/widgetsets</webappDirectory>
          <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
          <runTarget>mymavenproject</runTarget>
          <hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
          <noServer>true</noServer>
          <port>8080</port>
          <compileReport>false</compileReport>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>resources</goal>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-dev</artifactId>
            <version>${gwt.version}</version>
          </dependency>
          <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwt.version}</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-maven-plugin</artifactId>
        <version>1.0.2</version>
        <executions>
          <execution>
            <configuration>
            </configuration>
            <goals>
              <goal>update-widgetset</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      

      <!-- A simple Jetty test server at http://localhost:8080/mymavenproject can be launched with the Maven goal jetty:run 
        and stopped with jetty:stop -->
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.24</version>
        <configuration>
          <stopPort>9966</stopPort>
          <stopKey>mymavenproject</stopKey>
          <!-- Redeploy every x seconds if changes are detected, 0 for no automatic redeployment -->
          <scanIntervalSeconds>0</scanIntervalSeconds>
          <!-- make sure Jetty also finds the widgetset -->
          <webAppConfig>
            <contextPath>/mymavenproject</contextPath>
            <baseResource implementation="org.mortbay.resource.ResourceCollection">
              <!-- Workaround for Maven/Jetty issue http://jira.codehaus.org/browse/JETTY-680 -->
              <!-- <resources>src/main/webapp,${project.build.directory}/${project.build.finalName}</resources> -->
              <resourcesAsCSV>src/main/webapp,${project.build.directory}/${project.build.finalName}</resourcesAsCSV>
            </baseResource>
          </webAppConfig>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <repositories>
    <repository>
      <id>vaadin-snapshots</id>
      <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>vaadin-addons</id>
      <url>http://maven.vaadin.com/vaadin-addons</url>
    </repository>
  </repositories>

  
  <pluginRepositories>
    <pluginRepository>
      <id>codehaus-snapshots</id>
      <url>http://nexus.codehaus.org/snapshots</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <releases>
        <enabled>false</enabled>
      </releases>
    </pluginRepository>
    <pluginRepository>
      <id>vaadin-snapshots</id>
      <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <releases>
        <enabled>false</enabled>
      </releases>
    </pluginRepository>
  </pluginRepositories>
 

  <dependencies>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>vaadin</artifactId>
      <version>${vaadin.version}</version>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <version>${gwt.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>1.0.0.GA</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>1.0.0.GA</version>
      <classifier>sources</classifier>
      <scope>provided</scope></dependency>
        
     <dependency>
	<groupId>mysql</groupId>
	<artifactId>mysql-connector-java</artifactId>
	<version>3.1.14</version>
    </dependency>
    <dependency>
            <groupId>jfree</groupId>
            <artifactId>jfreechart</artifactId>
            <version>1.0.12</version>
            <type>jar</type>
            <scope>compile</scope>
    </dependency>
    <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>batik-svggen</artifactId>
            <version>1.7</version>
            <type>jar</type>
            <scope>compile</scope>
    </dependency>
    <dependency>
            <groupId>jfree</groupId>
            <artifactId>jcommon</artifactId>
            <version>1.0.15</version>
            <type>jar</type>
            <scope>compile</scope>
    </dependency>
    <dependency>
	<groupId>batik</groupId>
	<artifactId>batik-awt-util</artifactId>
	<version>1.6-1</version>
    </dependency>
    
    <dependency>
	<groupId>org.apache.xmlgraphics</groupId>
	<artifactId>batik-util</artifactId>
	<version>1.7</version>
    </dependency>
    <dependency>
	<groupId>org.apache.xmlgraphics</groupId>
	<artifactId>batik-xml</artifactId>
	<version>1.7</version>
    </dependency>
    
    <dependency>
      <groupId>org.vaadin.addons</groupId>
      <artifactId>refresher</artifactId>
      <version>1.1.0</version>
    </dependency>
    
    <dependency>
    <groupId>commons-codec</groupId>
    <artifactId>commons-codec</artifactId>
    <version>1.4</version>
    </dependency>
  </dependencies>

</project>

Did it rebuild it more than once? That was just a guess that it might skip it on subsequent builds that way. If it is rebuilding every time, then you should try the full solution that we’re using.
The blog I mentioned above
has full instructions and an example pom.xml.

In your case, I think the pom.xml you have is almost finished. You just need to move the widgetset compilation part into its own profile element so you can compile the widgets only when you want to and not every time. The example in that blog should show you the way.

Cheers,
Bobby