Opened 5 years ago

Closed 3 years ago

#8903 closed defect (needmoreinfo)

Vaadin maven artifact: repositories incorrectly declared, wrong scm url, missing optional gwt dependency

Reported by: ringerc Owned by: ticketmaster
Priority: trivial Milestone:
Component: Build and Packaging Version: 6.7.9
Keywords: cleaning Cc:
Depends on:
Workaround:
Verified: no
Fv: no

Description

Hi

It seems the Vaadin maven artifact, at least as of com.vaadin:vaadin:6.7.1:jar, doesn't declare its dependencies. Maven artifacts are required to declare their dependencies so that transitive dependency resolution works correctly.

If a dependency is optional, flag it as <optional>true</optional> in the <dependency/>, don't omit it. See:

http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html

Right now, unless you manually add a dependency on gwt to your Maven project, a Vaadin deployment is broken.

Also, the SCM URLs are out of date - the 6.7.1 pom.xml has:

  <scm>
    <url>http://dev.vaadin.com/browser/versions/6.6</url>
    <connection>scm:svn:http://dev.vaadin.com/svn/versions/6.6</connection>
    <developerConnection>scm:svn:http://dev.vaadin.com/svn/versions/6.6</developerConnection>
  </scm>

so you need to improve your artifact release process to auto-update those or add them to a checklist.

A public artifact pom.xml should not include <repositories/> or <pluginRepositories/> sections. See the Maven Central FAQ. The vaadin pom contains a repositories section, which should be removed from future releases. The user should be able to configure repositories; if you put them in your pom you'll screw up things like corporate nexus repositories.

See:

http://www.sonatype.com/people/2009/02/why-putting-repositories-in-your-poms-is-a-bad-idea/

http://www.sonatype.com/people/2010/03/why-external-repos-are-being-phased-out-of-central/

And for general info on how to publish better artifacts:

http://maven.apache.org/guides/mini/guide-central-repository-upload.html

https://docs.sonatype.org/display/Repository/Central+Sync+Requirements

A good published pom should follow the Central guidelines.

Attachments (1)

vaadin-6.7.1.pom (3.3 KB) - added by ringerc 5 years ago.
Modified pom.xml with repos removed, corrected scm url, addition of issue tracker info, and dependencies added

Download all attachments as: .zip

Change history (12)

comment:1 Changed 5 years ago by ringerc

  • Summary changed from Vaadin maven artifact doesn't declare dependencies to Vaadin maven artifact: missing dependencies, repositories incorrectly declared, wrong scm url

Changed 5 years ago by ringerc

Modified pom.xml with repos removed, corrected scm url, addition of issue tracker info, and dependencies added

comment:2 Changed 5 years ago by ringerc

  • Workaround modified (diff)

comment:3 Changed 5 years ago by ringerc

  • Workaround modified (diff)

Workaround is of course to add dependencies manually to pom of project using Vaadin:

  <properties>
    <gwt.version>2.3.0</gwt.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <version>${gwt.version}</version>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>1.0.0.GA</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

... though it actually looks like Vaadin works without GWT, it just produces lots of warnings spew on the console at least with JBoss AS 7.

Last edited 5 years ago by ringerc (previous) (diff)

comment:4 Changed 5 years ago by ringerc

SCM url should also be added to pom:

  <issueManagement>
    <system>TRAC</system>
    <url>http://dev.vaadin.com/report</url>
  </issueManagement>

comment:5 Changed 5 years ago by ringerc

If you're seeing "Failed to define class com.vaadin.[...] java.lang.LinkageError: Failed to link com/vaadin/[...]" errors in JBoss AS 7, you're missing Vaadin's undeclared GWT dependencies.

14:27:05,408 WARN [org.jboss.modules] (http-localhost-127.0.0.1-8080-1)
Failed to define class com.vaadin.terminal.gwt.client.ui.ShortcutActionHandler$ShortcutActionHandlerOwner
in Module "deployment.nymm.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/vaadin/terminal/gwt/client/ui/ShortcutActionHandler$ShortcutActionHandlerOwner (Module "deployment.nymm.war:main" from Service Module Loader)

then this is what's wrong.

comment:6 Changed 5 years ago by ringerc

BTW, ideally there'd be a vaadin-bom ("BOM" is "Bill of Materials") with a <build><plugins> section that specifies the vaadin and gwt plugins and their versions, and a <dependencyManagement> section that specifies the gwt and vaadin versions. That way users could get automatic gwt and vaadin compilation with the currently-imaginary:

<dependencyManagement>
  <dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-bom</artifactId>
    <version>6.7.2</version>
    <scope>import</scope>
  </dependency>
</dependencyManagement>
<dependencies>
  <dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin</artifactId>
  </dependency>
</dependencies>
<build>
  <plugins>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-maven-plugin</artifactId>
  </plugins>
  <plugins>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
  </plugins>
</build>

... which would with a properly written vaadin-bom give them an automatic gwt dependency, a gwt plugin preconfigured to build the vaadin widget sets, etc, allowing the removal of lots of boilerplate from the pom.xml of projects that use vaadin.

For how this works see the Seam 3 project BOM, RichFaces 4 BOM, or numerous other examples. Documentation here:

http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

comment:7 Changed 5 years ago by ringerc

According to the FAQ, a runtime dependency on GWT is supposed to be optional or un-necessary, in which case the pom's missing dependency would be ok (though it should be present and declared optional). However, it seems it isn't as optional as it should be, given that deploying to JBoss AS 7.1.1.Final without having gwt on the classpath produces a spew of "java.lang.LinkageError: Failed to link " warnings.

Filed as a separate bug (http://dev.vaadin.com/attachment/ticket/8905/), updating this one to reflect that the dependency is supposed to be optional.

comment:8 Changed 5 years ago by ringerc

  • Priority changed from undefined to trivial
  • Summary changed from Vaadin maven artifact: missing dependencies, repositories incorrectly declared, wrong scm url to Vaadin maven artifact: repositories incorrectly declared, wrong scm url, missing optional gwt dependency
  • Workaround modified (diff)

comment:9 Changed 4 years ago by Artur Signell

  • Verified unset

comment:10 Changed 3 years ago by Artur Signell

  • Fv unset

comment:11 Changed 3 years ago by Artur Signell

  • Keywords cleaning added
  • Resolution set to needmoreinfo
  • Status changed from new to closed

A lot of tickets have been left hanging in the issue tracker through the years. Some of them are still relevant, some of them have been fixed a long time ago and some are no longer valid. To get a better look on what is important and still relevant, we are closing old tickets which have not been touched in a long time.

No further work will be done on this ticket unless someone indicates that it's still relevant.

If this ticket is still relevant to you, please reopen it.

Note: See TracTickets for help on using tickets.