Alfresco SDK 2.0-beta-4 released in Maven Central!

It’s with extreme pleasure that, thanks to the great support from the Order of the Bee and the Community at large, we have released the Alfresco SDK 2.0.0-beta-4 … this time in Maven Central!

And 2.0.0 release is on the way, definitely out for you to use at the Alfresco Summit!

If you just can’t wait, check out a full tutorial and overview of new hot reloading features and IDE integration in this video (kudos to Ole for putting this together):

If you check out docs and release notes, I hope you’ll be gladly surprised by the number of enhancements and bug-fixes that went in this release, which, without any doubt, is to date the greatest ever achievement in ergonomics, productivity, quality and automation of Alfresco development! This represents a major step towards driving the Alfresco Community to become an organic, self sustained, proactive ecosystem of extensions and plugins for our favorite platform, Alfresco!

There are so many new features in this release, some of them very notable and I’d like to share them with you:

  • Compatibility with Alfresco Community 5.0.a+ (and soon with the upcoming Alfresco Enterprise 5.0.x). For 4.2 and below, you still need to use the SDK 1.x (see full SDK / Alfresco compatibility matrix here)
  • Availability on Maven central (see screenshot below)! Any Maven developer can just run a simple mvn archetype:generate and quickly create Alfresco projects directly from Maven Central! Is this JUST awesome?
Generate Alfresco Projects from Maven Central!
Generate Alfresco Projects from Maven Central!
  • True IDE integration with Eclipse, Idea and Netbeans (just Import Maven Projects) with rapid development support, by hot reloading of your Java classes, Web resources, webscripts, freemarker templates, using Spring Loaded and advanced Tomcat7 features (check out again the video above, you likely need to see it twice to believe it 🙂, to get all excited and farewell to all those ugly slow Alfresco restarts 🙂
  • Unit and integration testing support, with remote JUnit testing features to avoid context reloading and run unit tests (from your IDE) in seconds (or less)
  • Easy new starter setup and run scripts in each archetype. Just create the project, execute ./run.sh and off you go!
  • Updated SDK 2.x docs (separate from SDK 1.x docs)
  • rm profile (enable with -Prm) in the all-in-one archetype to enable Records Management development
  • Multiple bug fixes and stabilization

The feedback we got is that this new version is just AMAZING and enables levels of productivity never seen before on Alfresco project. And, for those of you that have followed me in this journey started 6 years ago, this shouldn’t be anything less than mind-boggling.

I really wish you will experience the same and I’d love to hear your feedback and contributions. I’d welcome comments here, issues or pull requests on the SDK project, or even emails on the Maven Alfresco mailing list. Also, stay tuned, since 2.0.0 final is targeted to introduce new juicy features, like easy Selenium functional testing,  even easier configuration of Community / Enterprise artifacts via a simple profile and integration of the Alfresco Technical Validation tool to ensure quality of your extensions.

And if this is getting you half as excited as I am right now, make sure you come to the next month’s Alfresco Summit (in San Francisco or London) where, together with Maurizio, we’ll extensively present how, in just 50 minutes, you can leverage the Alfresco SDK to get your project from inception to its first release and how, using Alfresco Boxes, you can consume this release and deploy arbitrarily complex architectures, on premise or in the cloud, in FULL automation.  Now that’s what I call an overarching vision

And if you really want to become a Guru, come join the Maven Alfresco training that Maurizio will run in both venues, one very worth day spent to save days of sub-optimal development 🙂

Stay tuned and send us your feedback!

20 thoughts on “Alfresco SDK 2.0-beta-4 released in Maven Central!

  1. […] Gab has written a great post about the release, which includes a ton of goodies, like hot reloading java code, web scripts and client side resources. We’ve also included a records management profile and extra goodies. […]

    Reply

  2. Hi Gabriele,

    that looks impressive. I gave a try today but no luck in reloading java classes. JavaScript, ftl files works as expected but not the java backed webscript. Am I missing any trick ??

    I have maven 3.2.3. with eclipse m2e plugin 1.6 downloaded form http://download.eclipse.org/technology/m2e/milestones/1.6
    I have jdk 1.7.0_40
    Alfresco Maven SDK snapshot 2.0.0-beta4
    Alfresco 5.0.a

    Thanks,
    Vignesh

    Reply

    1. Did you run using the ./run.sh script provided? I ask that, since that will set up the springloaded environment (download and run the JVM with the agent).

      Looks like your springloaded reloading isn’t really working, but on every platform I have tested with worked with no issue.

      Reply

  3. Hi Gab,

    Is it possible to do junit testing on remote server ?

    Thanks,
    Yogesh Prajapati

    Reply

    1. Hi Marcin,

      this is a known issue. See https://issues.alfresco.com/jira/browse/ALF-9970.

      Development mode breaks the admin console, and at this point there are no plans to fix is (because the more and more admin tools are being moved to the new Alfresco repository admin console).

      You can disable dev mode by changing the share-config-custom.xml that comes bundled in the share-amp-archetype in src/test/resources/alfresco/web-extension.

      Reply

  4. Hi Gab,

    I want to do remote junit testing in such way like –
    I have created one unit test class in my local and I want to test it in my QA environment with hot reloading..

    is this possible?

    Thanks,
    Yogesh Prajapati

    Reply

    1. Yep this is possible as long as the receiving end (QA) has the proper test classes deployed in it (and it’s configured with spring-loaded to look at at location where you change your classes). In fact the class is not *serialized* and sent to the server, you only invoke test remotely that are already in the webapp.

      You can configure the @Remote annotation to point to your QA server.

      Reply

  5. Hi Gab,

    Recently I build Alfresco 5.0.a with Alfresco SDK 2.0.0-beta-4 and it really works well. however, for version 5.0.b, I am getting below error. Am I missing any configuration in POM? thanks!

    Error:
    [org.alfresco.demoamp.test.DemoComponentTest@15e1f383]
    java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
    at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
    at com.tradeshift.test.remote.RemoteTestRunner.run(RemoteTestRunner.java:73)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
    Caused by: org.alfresco.error.AlfrescoRuntimeException: 09060000 Bootstrap failed
    at org.alfresco.repo.importer.ImporterBootstrap.bootstrap(ImporterBootstrap.java:362)
    at org.alfresco.repo.importer.ImporterBootstrap.onBootstrap(ImporterBootstrap.java:723)
    at org.springframework.extensions.surf.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:56)
    at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:209)
    at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:180)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:948)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
    at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
    at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
    at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
    at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
    … 25 more
    Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘lucene’ is defined
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:575)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1111)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:276)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
    at org.alfresco.repo.management.subsystems.SwitchableApplicationContextFactory$SwitchableState.start(SwitchableApplicationContextFactory.java:116)
    at org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean.start(AbstractPropertyBackedBean.java:991)
    at org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean.getState(AbstractPropertyBackedBean.java:274)
    at

    Reply

    1. 2.0.0-beta-4 is NOT compatible with 5.0.b. We’ll release the 2.0.0 final to do so.

      In the meanwhile you can use the 2.0.0-SNAPSHOT from Maven central and that would already work (unstable) with 5.0.b.

      Reply

  6. I’m running v2 beta 4 beta AMP build archetype and get errors when trying to run integration-test amp-to-war. Message in Eclipse console always says that mysql components are missing even though I have not made any changes to the default configuration. I am expecting it to run H2 by default.

    **********************************************
    … 93 more
    Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.alfresco.repo.domain.schema.DataSourceCheck]: Constructor threw exception; nested exception is java.lang.RuntimeException: Database connection failed: Cannot load JDBC driver class ‘org.gjt.mm.mysql.Driver’
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:108)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
    … 104 more
    Caused by: java.lang.RuntimeException: Database connection failed: Cannot load JDBC driver class ‘org.gjt.mm.mysql.Driver’
    at org.alfresco.repo.domain.schema.DataSourceCheck.(DataSourceCheck.java:59)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
    … 106 more
    Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class ‘org.gjt.mm.mysql.Driver’
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at org.alfresco.repo.domain.schema.DataSourceCheck.(DataSourceCheck.java:53)
    … 111 more
    Caused by: java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558)
    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1420)
    … 114 more

    Oct 21, 2014 2:27:39 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized
    INFO: WSSERVLET12: JAX-WS context listener initializing
    Oct 21, 2014 2:27:46 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate
    INFO: WSSERVLET14: JAX-WS servlet initializing
    Oct 21, 2014 2:27:46 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error listenerStart
    Oct 21, 2014 2:27:46 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Context [/alfresco] startup failed due to previous errors
    Oct 21, 2014 2:27:46 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate destroy
    INFO: WSSERVLET15: JAX-WS servlet destroyed
    Oct 21, 2014 2:27:46 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextDestroyed
    INFO: WSSERVLET13: JAX-WS context listener destroyed
    Oct 21, 2014 2:27:46 PM org.apache.catalina.core.ApplicationContext log
    INFO: Closing Spring root WebApplicationContext
    Oct 21, 2014 2:27:46 PM org.apache.catalina.core.ApplicationContext log
    INFO: Shutting down log4j
    Oct 21, 2014 2:27:46 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
    SEVERE: The web application [/alfresco] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@6dd1f5aa]) and a value of type [org.apache.cxf.bus.CXFBusImpl] (value [org.apache.cxf.bus.CXFBusImpl@7357a439]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    Oct 21, 2014 2:27:46 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
    SEVERE: The web application [/alfresco] created a ThreadLocal with key of type [com.sun.xml.bind.v2.ClassFactory$1] (value [com.sun.xml.bind.v2.ClassFactory$1@4386be8a]) and a value of type [java.util.WeakHashMap] (value [{class javax.xml.bind.annotation.W3CDomHandler=java.lang.ref.WeakReference@6ce82fb5}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    Oct 21, 2014 2:27:46 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler [“http-bio-8080”]

    Reply

    1. It should use h2 by default. What are you using to run it, Eclipse directly ? Or the provided run.sh?

      Seems like Eclipse (or something else) is overriding the global properties, which should be picked from src/test/properties/local/alfresco-global.properties.

      Can you raise an issue at https://github.com/Alfresco/alfresco-sdk/issues if this is isn’t fixed yet?

      Reply

      1. I am building the project using the mvn archetype:generate…… command and then import to Eclipse. I will submit an issue. Thank you.

        I’m also curious as to where web script Javascript debug output goes when running integration-test. I’ve set DEBUG and log4j.logger.org.alfresco.repo.jscript.ScriptLogger=DEBUG and the Debug-Output is checked in Eclipse run configuration. There is no debug statement in the console or the log file. Java program debug statements appear as expected.

        Reply

        1. Regarding the debug statement output, I’m referring to v1 of the Maven SDK.

          Reply

  7. Hi, Gab! Can you help me please with remote JUnit testing on all-in-one-archetype? I’m using IntelliJ IDEA.

    I succeeded in remote testing amp-archetype. And I want to say it’s really awesome!

    But when I try to do the trick with all-in-one using MAVEN_OPTS=”-Xms1024m -Xmx2048m -XX:PermSize=1024m -javaagent:/path/to/springloaded-1.2.0.RELEASE.jar -noverify” mvn clean install -Prun
    every tinny test is trying to re-start the whole Alfresco. Ofcource it fails by “Address already in use” exception.

    Can you tell me please, what am I doing wrong? Is it incorrect configuration of @Remote annotation (@Remote(runnerClass = SpringJUnit4ClassRunner.class)) and for all-ion-one testing it should be different?

    Reply

    1. I finally solved this problem. But I don’t think my approach is correct.

      1. First of all I realised that during unit-testing there is no JUnit RemoteServer listening for tests on localhost:4578.
      2. So then I figured out alfresco-rad-2.0.0-beta-4.jar is not imported in repo.
      3. And last but not least. My solution was to remove test from

      org.alfresco.maven
      alfresco-rad
      ${maven.alfresco.version}
      test

      in the alfresco-sdk-parent-2.0.0-beta-4.pom

      Sooooo… I really suffer the lack of knowledge in Maven. But it seems to me that I’m totally wrong in my approach.

      Reply

  8. Hi Gabriele,

    I have used Alfresco SDK 2.0-beta-4 both in Eclipse and from the command line with Alfresco 5.0.a and Share 5.0.a. Now, when I try to use Alfresco 5.0.c and Share 5.0.c, both in alfresco repo and share “mvn integration-test -Pamp-to-war” produces this error;

    SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
    java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
    at org.apache.commons.logging.impl.SLF4JLocationAwareLog.error(SLF4JLocationAwareLog.java:225)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:331)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

    Is this a known problem or do you think I miss something about 5.0.c?
    I also tried to use the 2.0.0-SNAPSHOT, but I have a different error:

    ERROR] Non-resolvable parent POM for org.alfresco.maven:alfresco-sdk-parent:2.0.0-SNAPSHOT: Could not find artifact org.alfresco.maven:alfresco-sdk-aggregator:pom:2.0.0-SNAPSHOT in alfresco-public (https://artifacts.alfresco.com/nexus/content/groups/public) @ org.alfresco.maven:alfresco-sdk-parent:2.0.0-SNAPSHOT, /home/alfresco/.m2/repository/org/alfresco/maven/alfresco-sdk-parent/2.0.0-SNAPSHOT/alfresco-sdk-parent-2.0.0-SNAPSHOT.pom, line 14, column

    Do you have any suggestion to get out of the impasse?

    thanks for your help,

    ciao Francesco

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *