PDA

View Full Version : Using Spring BlazeDS Integration nightly builds with Maven



jeremyg484
Sep 9th, 2009, 07:51 PM
For those of you who are using Maven for your project builds and depending on maven-central-compatible pom's (i.e., not the OSGi-ready dependencies in the SpringSource Enterprise Bundle Repository), I thought it would be worth documenting the process of pulling a nightly snapshot build of Spring BlazeDS Integration into your project in case you don't mind living on the edge a little (i.e., fair warning that things might break) and are in need of the latest fixes in between releases.

All development is now happening in SVN trunk for what will eventually be version 1.5.0. At this point we have no intention of any further 1.0.x releases unless a critical bug arises.

Currently, the only snapshots we are publishing are the core Maven artifacts for 1.5.0. We have not yet incorporated publishing of a full .zip distribution with docs, source, etc. (as we did with 1.0.x) into our nightly build process. We will likely begin publishing a full nightly distro right before we release the first 1.5.0 Milestone.

As a consequence of our migration to Maven as the single build system for the project, as well as the fact that there will eventually be additional artifacts included (beyond just the core jar) in 1.5.0, the main dependency's artifact id has changed to spring-flex-core.

To grab the current nightly snapshots with Maven, you must first have the maven.springframework.org snapshot repository configured either in your settings.xml (preferred) or directly in your project's pom. The correct format of the repository entry is:



<repository>
<id>spring-snapshot</id>
<name>Spring Portfolio Snapshot Repository</name>
<url>http://maven.springframework.org/snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>


Once you have the correct repository settings, you would express a dependency on spring-flex-core as follows:


<dependency>
<groupId>org.springframework.flex</groupId>
<artifactId>spring-flex-core</artifactId>
<version>1.5.0.BUILD-SNAPSHOT</version>
</dependency>


*** One problem you will likely encounter is that 1.5.0 depends on BlazeDS 4, which is not currently published in any known public Maven repository. You will need to install the BlazeDS 4 Maven artifacts into your local repository in order to build successfully against the 1.5.0 nightly snapshots. For example, you can use 'mvn install:install-file' to install to your local repository, or 'mvn deploy:deploy-file' to install to your own hosted repo. You can grab the necessary pom's from our SVN repository here:

https://src.springframework.org/svn/spring-flex/trunk/local-repo/poms/blazeds-4.0.0.14931

javajoshw
Sep 15th, 2009, 12:55 PM
I am trying to build testdrive with Maven. At first I thought this applied to testdrive but now I think it applies to the lib.

That said, I am getting an error when I try to build testdrive from the nightly build with maven. After I run mvn install I get the following error in the cmd window.



[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) org.springframework.flex:spring-flex:jar:1.0.1.BUILD-SNAPSHOT

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=org.springframework.flex -DartifactId=s
pring-flex -Dversion=1.0.1.BUILD-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:

mvn deploy:deploy-file -DgroupId=org.springframework.flex -DartifactId=spr
ing-flex -Dversion=1.0.1.BUILD-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Du
rl=[url] -DrepositoryId=[id]

Path to dependency:
1) org.springframework.flex.samples:testdrive:war:1.0 .1.BUILD-SNAPSHOT
2) org.springframework.flex:spring-flex:jar:1.0.1.BUILD-SNAPSHOT

----------
1 required artifact is missing.

for artifact:
org.springframework.flex.samples:testdrive:war:1.0 .1.BUILD-SNAPSHOT

from the specified remote repositories:
ObjectWEB (http://maven.ow2.org/maven2/),
central (http://repo1.maven.org/maven2),
flex-mojos-repository (http://repository.sonatype.org/content/groups/public)


Any help would be great. Thanks.

javajoshw
Sep 16th, 2009, 08:10 AM
I tried to follow your instructions for building the sbi lib with Maven and I get the following error. Any ideas?



[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'install'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring BlazeDS Integration
[INFO] task-segment: [install:install-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [install:install-file]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Missing group, artifact, version, or packaging information
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Sep 16 09:05:02 EDT 2009
[INFO] Final Memory: 3M/254M
[INFO] ------------------------------------------------------------------------

javajoshw
Sep 16th, 2009, 01:32 PM
OK, so I figured out what I did wrong. My apologies as I am new to both Spring and Maven.

In order to build the SBI jar I had to be in the folder that had "dist" in it. For my example that was "spring-flex-1.0.1.CI-283-with-dependencies\spring-flex-1.0.1.CI-283". Then I was able to run #2 above with version changes.

To build the Testdrive projects, I added the dependency listed above to the testdrive pom.xml and then I went to "projects\spring-flex-samples\spring-flex-testdrive" and it built too.

Thanks for your work on this guys.
Joshua

jeremyg484
Feb 9th, 2010, 02:48 PM
Updated the top post with potentially simpler way to grab the nightly snapshots with Maven.

couzteau
Feb 16th, 2010, 05:51 PM
My maven build is missing the BlazeDS-core jar that the nightly build depends on:
com.adobe.blazeds:blazeds-core:jar:4.0.0.10153


Using this dependency:

<dependency>
<groupId>org.springframework.flex</groupId>
<artifactId>spring-flex</artifactId>
<version>1.5.0.BUILD-SNAPSHOT</version>
</dependency>

The blazeds builds posted below do not contain the jar:
http://opensource.adobe.com/wiki/display/blazeds/download+blazeds+trunk

Where can I get it?

Thank you

Jacques

pledge
Mar 6th, 2010, 07:10 AM
Having the same problem here. You can install them to your local repo but would be nice to know which remote repo to add in to get them.

couzteau
Mar 6th, 2010, 02:04 PM
WHere did you get the jar from. I would be ok to install it, but I cannot find it anywhere. If you have it, pls send me a link.

pledge
Mar 6th, 2010, 04:18 PM
You don't need to use the exact version. I just took the latest nightly build from your link and installed that.

Extract the ZIP, then the WAR.
Run these whilst inside the lib directory (change the number if a new one came out):



mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14593 -DartifactId=blazeds-common -Dfile=flex-messaging-common.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14593 -DartifactId=blazeds-core -Dfile=flex-messaging-core.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14593 -DartifactId=blazeds-proxy -Dfile=flex-messaging-proxy.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14593 -DartifactId=blazeds-remoting -Dfile=flex-messaging-remoting.jar
mvn install:install-file -Dpackaging=jar -DgroupId=com.adobe.blazeds -Dversion=4.0.0.14593 -DartifactId=blazeds-rds-server -Dfile=flex-rds-server.jar


Then in your own project's POM add these to override the ones being pulled in by Spring


<dependencies>
<dependency>
<groupId>com.adobe.blazeds</groupId>
<artifactId>blazeds-core</artifactId>
<version>${blazeds.version}</version>
</dependency>
<dependency>
<groupId>com.adobe.blazeds</groupId>
<artifactId>blazeds-common</artifactId>
<version>${blazeds.version}</version>
</dependency>
<dependency>
<groupId>com.adobe.blazeds</groupId>
<artifactId>blazeds-proxy</artifactId>
<version>${blazeds.version}</version>
</dependency>
<dependency>
<groupId>com.adobe.blazeds</groupId>
<artifactId>blazeds-remoting</artifactId>
<version>${blazeds.version}</version>
</dependency>
<dependency>
<groupId>com.adobe.blazeds</groupId>
<artifactId>blazeds-rds-server</artifactId>
<version>${blazeds.version}</version>
</dependency>
</dependencies>




<properties>
<blazeds.version>4.0.0.14593</blazeds.version>
</properties>

couzteau
Mar 8th, 2010, 07:27 PM
Thank you pledge. I can compile now. But when I launch my app in tc server an execption flies in Context initialization, stacktrace below:

My BlazeDs Messager broker is defined like this:
<flex:message-broker/>

I don't define bean _messageBrokerDefaultHandlerMapping mself.

Any ideas anyone?

Thank you
Jacques

Stacktrace:

2010-03-08 17:11:05,504 ERROR [org.springframework.web.servlet.DispatcherServlet] - Context initialization failed
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '_messageBrokerDefaultHandlerMapping': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '_messageBroker': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanInitializati onException: MessageBroker initialization failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 90)
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:287 )
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:557)
at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:842)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:416)
at org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:4 02)
at org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:316 )
at org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:282)
at org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:126)
at javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:4149)
at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4458)
at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployWAR(H ostConfig.java:848)
at org.apache.catalina.startup.HostConfig.deployWARs( HostConfig.java:724)
at org.apache.catalina.startup.HostConfig.deployApps( HostConfig.java:493)
at org.apache.catalina.startup.HostConfig.start(HostC onfig.java:1211)
at org.apache.catalina.startup.HostConfig.lifecycleEv ent(HostConfig.java:314)
at org.apache.catalina.util.LifecycleSupport.fireLife cycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:741)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
at org.apache.catalina.core.StandardService.start(Sta ndardService.java:516)
at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalin a.java:587)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:290)
at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:415)

pledge
Mar 10th, 2010, 04:37 AM
Is that the full error? I had something similar which was being caused by a missing dependency on spring-aop, which hadn't been pulled through as a transitive dependency by Maven.

pledge
Mar 10th, 2010, 05:19 AM
Have the contents of http://s3.amazonaws.com/maven.springframework.org/snapshot being deleted? It seems to no longer work.

Edit: Ignore, faulty Nexus settings.

jcarter
May 16th, 2010, 08:12 PM
The POMs are available at <http://s3.amazonaws.com/maven.springframework.org/snapshot/org/springframework/flex/spring-flex/1.5.0.BUILD-SNAPSHOT/spring-flex-1.5.0.BUILD-20100516.010007-81.pom> but the corresponding JAR appears to be missing.

jeremyg484
May 17th, 2010, 10:51 AM
I believe the correct URL for the snapshot repo these days is:

http://maven.springframework.org/snapshot

Note that as we still host everything in S3, it's not directly browsable. If you want to browser the contents, you can use:

https://s3browse.springsource.com/browse/maven.springframework.org/

Also note that as a result of our moving to using Maven as the single build system for the project, and the fact that there will eventually be additional artifacts in the distro in the final 1.5, the main dependency you want to grab is now spring-flex-core:



<dependency>
<groupId>org.springframework.flex</groupId>
<artifactId>spring-flex-core</artifactId>
<version>1.5.0.BUILD-SNAPSHOT</version>
</dependency>


I will update the original post to reflect the current state.

jcarter
May 17th, 2010, 11:12 AM
Much improved. Thanks.

ConorMull
Sep 30th, 2010, 11:46 AM
Hi,

I was just wondering if there is any date yet for an official release of 1.5? I have been trying in vain to configure the data service feature of flash builder 4. I keep receiving the RDS 404 message with regard to ide.cfm. I am hoping all this will be a lot easier to integrate with Maven once the release happens?...

Slidewayz
Jan 10th, 2011, 11:18 AM
I am also having sample problem, may be i need to see the help section in detail. :)

This is what I used to get started: http://refcardz.dzone.com/refcardz/flex-4-and-spring-3

I found it 'better' than the example since I built it up step-by-step with an explanation of what each piece is doing.

agodinhost
Nov 28th, 2011, 07:23 AM
Hi, I'm using the pom.xml in the modules trunk but seems that the opt-tomcat7 (and 6, I think) is missing a <scope> tag. The current pom.xml brings all tomcat7 dependencies and we don't need that.

So, my patch:

Index: pom.xml
================================================== =================
--- pom.xml (revision 23208)
+++ pom.xml (working copy)
@@ -34,6 +34,7 @@
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>7.0.8</version>
+ <scope>provided</scope>
</dependency>
</dependencies>
<properties>

I hope it helps.