Search code examples
mavenvaadinpom.xmladd-on

Is there a working maven pom for vaadin FancyLayouts addon?


I have decided to use a layout addon in my Vaadin project which is a maven project, but after taking the maven pom available on the addon page, it somehow fails to resolve from the maven repository.

Please can some tell me how to get a working maven pom or how I can get around this?

Here is the maven

<repository>
   <id>vaadin-addons</id>
   <url>http://maven.vaadin.com/vaadin-addons</url>
</repository>

<dependency>
   <groupId>org.vaadin.alump.fancylayouts</groupId>
   <artifactId>fancylayouts-addon</artifactId>
   <version>0.2.1</version>
</dependency> 

Solution

  • To make this addon work into your maven project layout, you need to download the project zip bundle from github.

    Extract the zip content to any directory and cd into the addon folder:

    unzip FancyLayouts-master.zip
    cd FancyLayouts-master/fancylayouts-addon/
    

    Once there, using your favorite text editor, change the first lines of the pom.xml. Replace the <parent>...</parent> tags along with its content with the version tag (althoug the addon page in the vaadin directory says that the addon version is 0.2.1 the project code version for the downloaded bundle is 0.3-SNAPSHOT). The first 14 lines of the file should look like this:

    <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.vaadin.alump.fancylayouts</groupId>
      <artifactId>fancylayouts-addon</artifactId>
      <packaging>jar</packaging>
      <name>FancyLayouts addon</name>
      <description>FancyLayouts Vaadin addon</description>
      <version>0.3-SNAPSHOT</version>  
    
      <organization>
          <name>Sami Viitanen</name>
          <url>http://vaadin.com/alump</url>
      </organization>
    

    Build the addon using: mvn install

    It should build successfully and install automatically into your local repository, to reference it from your project, add the following dependency:

        <dependency>
           <groupId>org.vaadin.alump.fancylayouts</groupId>
           <artifactId>fancylayouts-addon</artifactId>
           <version>0.3-SNAPSHOT</version>
        </dependency>
    

    Explanation of the workaround: If you try to install the addon using just mvn install and then reference the dependency in your pom.xml, maven will complain about not finding the parent pom for this library (something like: Cannot find parent: org.vaadin.alump:fancylayouts for project), thats why we have to delete the parent tag and rebuild the addon without it