Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Creating Maven/Eclipse project with SmartGWT?

    Problem Statement:
    I've been piecing together the strategy for creating a Maven/SmartGWT/Eclipse project, but I'm not able to include the smartgwt dependencies.

    Please advise.


    STRATEGY: here is the strategy to create my SmartGWT/Maven/Eclipse project:
    1. I setup Maven's settings.xml file (see below).
    2. Create a GWT Maven/Eclipse project from command line:
      • Code:
         		mvn archetype:generate \
          		   -DarchetypeGroupId=org.codehaus.mojo \
          		   -DarchetypeArtifactId=gwt-maven-plugin \
          		   -DarchetypeVersion=2.8.0-beta1
      • This is the link to https://gwt-maven-plugin.github.io/g...archetype.html
      • I use the following properties configuration:​
      • Code:
         		Confirm properties configuration:
          		groupId: my.sample
          		artifactId: sgwtexample
          		version: 1.0-SNAPSHOT
          		package: my.sample
          		module: Example
    3. [FONT=Menlo]I am able to mvn clean and mvn install from command line:[/FONT]
    4. [FONT=Menlo]I added the following dependency without any problems with clean and install:[/FONT]
      • Code:
         		        <dependency>
          		            <groupId>javax.servlet</groupId>
          		            <artifactId>javax.servlet-api</artifactId>
          		            <version>${servlet.api.version}</version>
          		        </dependency>
    5. The problem occurs when I add:
      • Code:
         		        <properties>
        		          <smartgwt.version>5.1-p20160127</smartgwt.version>
          		          <servlet.api.version>3.1.0</servlet.api.version>
          		        </properties>
        		
        		​        <!-- Core: SmartGWT -->
        		        <dependency>
          		          <groupId>com.isomorphic.smartgwt.pro</groupId>
          		          <artifactId>smartgwt-pro</artifactId>
          		          <version>${smartgwt.version}</version>
          		        </dependency>
    6. I tried first
      Code:
      mvn install -e
      and the
      Code:
      mvn install -Pisc -e
      • ​But I get the following error with the -e option:
        Code:
         		[ERROR] Failed to execute goal on project sgwtexample: Could not resolve dependencies for project my.sample:sgwtexample:war:1.0-SNAPSHOT: Failure to find com.isomorphic.smartgwt.pro:smartgwt-pro:jar:5.1-p20160127 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
          		org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project sgwtexample: Could not resolve dependencies for project my.sample:sgwtexample:war:1.0-SNAPSHOT: Failure to find com.isomorphic.smartgwt.pro:smartgwt-pro:jar:5.1-p20160127 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
          		    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221)
          		    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127)
          		    at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:245)
          		    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199)
          		    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
          		    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
          		    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
          		    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
          		    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
          		    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
          		    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
          		    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
          		    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
          		    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
          		    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
          		    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
          		    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          		    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          		    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          		    at java.lang.reflect.Method.invoke(Method.java:606)
          		    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
          		    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
          		    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
          		    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
          		Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project my.sample:sgwtexample:war:1.0-SNAPSHOT: Failure to find com.isomorphic.smartgwt.pro:smartgwt-pro:jar:5.1-p20160127 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
          		    at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:211)
          		    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195)
          		    ... 23 more
          		Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Failure to find com.isomorphic.smartgwt.pro:smartgwt-pro:jar:5.1-p20160127 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
          		    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:384)
          		    at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:205)
          		    ... 24 more
          		Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find com.isomorphic.smartgwt.pro:smartgwt-pro:jar:5.1-p20160127 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
          		    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
          		    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
          		    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:367)
          		    ... 25 more
          		Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find com.isomorphic.smartgwt.pro:smartgwt-pro:jar:5.1-p20160127 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
          		    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:231)
          		    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:206)
          		    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:585)
          		    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:503)
          		    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
          		    ... 27 more
          		[ERROR] 
          		[ERROR] Re-run Maven using the -X switch to enable full debug logging.
          		[ERROR] 
          		[ERROR] For more information about the errors and possible solutions, please read the following articles:
          		[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

    SETTINGS.XML
    Code:
     <settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
       
        <profiles>
          <profile>
            <id>isc</id>
            <properties>
              <isc.username>SMARTCLIENT.COM-USERNAME</isc.username>
              <isc.password>********</isc.password>
              <license>ENTERPRISE</license>
              <!--
                  <license>LGPL</license>
                  <license>EVAL</license>
                  <license>PRO</license>
                  <license>POWER</license>
                  <license>ENTERPRISE</license>
                  -->
              <!-- set to true if optional analytics has been licensed with power/enterprise -->
              <analytics>true</analytics>
              <!-- set to true if optional messaging has been licensed with power/enterprise -->
              <messaging>true</messaging>
              
              <!-- to deploy the smartgwt artifacts to some corporate repo via deploy goal -->
              <!--
                  <repository.id>corporate-nexus</repository.id>
                  <repository.url>http://localhost:9081/nexus/content/repositories/thirdparty/</repository.url>
                  -->
            </properties>
            
            <!-- configuration providing access to staging repos -->
            <pluginRepositories>
              <pluginRepository>
                <id>sonatype-staging</id>
                <name>Sonatype Staged Release</name>
                <releases>
                  <enabled>true</enabled>
                </releases>
                <snapshots>
                  <enabled>false</enabled>
                </snapshots>
                <url>https://oss.sonatype.org/content/repositories/comgooglecodesmartgwt-maven-plugin-1007/</url>
                <layout>default</layout>
              </pluginRepository>
              <pluginRepository>
                <id>sonatype-snapshots</id>
                <name>Sonatype Release Snapshots</name>
                <releases>
                  <enabled>false</enabled>
                </releases>
                <snapshots>
                  <enabled>true</enabled>
                </snapshots>
                <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
                <layout>default</layout>
              </pluginRepository>
            </pluginRepositories>
          </profile>
        </profiles>
        <activeProfiles>
          <activeProfile>isc</activeProfile>
        </activeProfiles>
        <pluginGroups>
          <pluginGroup>com.googlecode.smartgwt-maven-plugin</pluginGroup>
        </pluginGroups>
      </settings>


    #2
    It looks like you want to use SmartGWT Pro in your project. This work for me in a similar setup:

    1. First, my Maven's setings.xml. Note that you need to define the server where you will get the artifacts from, providing your username and password. I guess you try to do something similar in your setup above, but this is how I defined it, and it allows me to get new SmartGWT versions using the com.isomorphic:isc-maven-plugin:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
      
      <localRepository>C:/Path/To/Repo</localRepository>
    
      <pluginGroups>
          <pluginGroup>com.isomorphic</pluginGroup>
      </pluginGroups>
    
      <servers>
        <server>
            <id>smartclient-developer</id>
            <username>yourUserName</username>
            <password>yourPassword(0)</password>
        </server>
      </servers>
    </settings>
    2. Make sure to reference this file in Eclipse's preferences, under Maven - User Settings.

    3. From Eclipse you can create a new Run Configuration of type Maven Build, using the following goal (notice the version number and build date) to get the desired SmartGWT version from Isomorphics repository:
    Code:
    com.isomorphic:isc-maven-plugin:install -Dproduct=SMARTGWT -Dlicense=PRO -DbuildNumber=5.1p -DbuildDate=2016-03-18
    4. Finally, you can reference the desired SmartGWT version in pom.xml (here are the parts related to SmartGWT artifacts):

    Code:
        <properties>
        
            <!-- Explictly specify a default encoding to avoid relying on the OS locale. -->
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    
            <!-- Artifact versions -->
            <gwt.version>2.7.0</gwt.version>
            <smartgwt.version>5.1-p20160318</smartgwt.version>
            <servlet.api.version>3.0.1</servlet.api.version>
        
        </properties>
    
        <dependencies>
    
            <!-- Core: GWT -->
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-servlet</artifactId>
                <version>${gwt.version}</version>
                <scope>runtime</scope>
            </dependency>
    
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-user</artifactId>
                <version>${gwt.version}</version>
                <scope>provided</scope>
            </dependency>
    
            <!-- Core: SmartGWT -->
            <dependency>
                <groupId>com.isomorphic.smartgwt.pro</groupId>
                <artifactId>smartgwt-pro</artifactId>
                <version>${smartgwt.version}</version>
            </dependency>
    
            <!-- Core: SmartGWT Developer Tools -->
            <dependency>
                <groupId>com.isomorphic.smartgwt.pro</groupId>
                <artifactId>isomorphic-tools</artifactId>
                <version>${smartgwt.version}</version>
            </dependency>        
            
               <!-- Servlets -->
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>${servlet.api.version}</version>
            </dependency>
            
        </dependencies>
    I hope this helps...

    Comment


      #3
      Yes indeed it helps! I don't have PRO licensing, so I just changed the extension (ENTERPRISE) and now it works. The key was two fold:
      • Your #1 settings file.
      • Your #3 of obtaining the right version of SmartGWT.
      Thank you!!

      Comment


        #4
        Great. Glad it helped...

        Comment


          #5
          CarlosSierra, how are you able to debug/run your project?

          Comment


            #6
            Take a look at this for client side debugging: http://sdbg.github.io/
            Server side, I just run in debug mode and set regular break points.

            Comment


              #7
              CarlosSierra, I've been trying out sdbg with setups of:
              * pure gwt project and
              * with the maven.

              I'm experiencing the same problem with both setups (above) in debug/SDBG mode where I can successfully set a break and debug. Once I resume and try to repeat my actions, I on occasion (not consistently) will not break at the point. The Chrome browser seems to be hung.

              At other times, I can debug all I want without having to relaunch Chrome in the SDBG mode.

              Have you any experience/advise?

              Comment


                #8
                Yes, from time to time, I do get behavior like that, so basically I end up doing what you are doing (I haven't gotten the time to explore it more deeply). I think it depends on your setup (how do you run SuperDevMode, do you use external server while debugging, etc), so I would advice to ask in SDBG's forum about it, to get a permanent solution (if one is available): https://groups.google.com/forum/m/#!forum/sdbg

                Ps. If you get to solve this, please post your solution here so that other will benefit from it!

                Comment

                Working...
                X