cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Create An Extension Part 5

100% helpful (1/1)

 

 

Step 11: Build Extension

 

You can use either Gradle or Ant to build your ThingWorx Extension Project. Ant is the preferred method.

 

Build Extension with Gradle

 

  1. Right click on your project ->Gradle (STS)->Tasks Quick Launcher.

    gradle-build-1.jpg

     


     

    NOTE: This opens up a new window.

     

  2. Set Project from the drop-down menu to your project name and type Tasks as build.

  3. Press Enter

    gradle-build-2.png

     

    NOTE: This will build the project and any error will be indicated in the console window.

  4. Your console window will display BUILD SUCCESSFUL. This means that your extension is created and stored as a zip file in your_project->build->distributions folder.

    gradle-success.jpg

     

Build Extension with Ant

 

  1. Go to the Package explorer -> your_project->.

  2. Right click on build-extension.xml->Run As->Ant Build

    ant-build-1.png

     

  3. Your console output will indicate BUILD SUCCESSFUL.

    ant-success.png

     

    NOTE: This will build your project and create the extension zip in the your_project->build->distributions folder of your project.

 

 

Step 12: Import Extension 

 

If you have valuable data on your ThingWorx server, save the current state before importing an untested extension by duplicating and renaming the ThingworxStorage directory. This will save all current entities and a new, empty ThingworxStorage directory will be generated when Tomcat is restarted. To restore your saved state, rename the duplicate directory back to ThingworxStorage. Alternatively, If you do not back up your storage, make sure that any entities you want to save are exported into xml format. This way you will be able to restore your ThingWorx server to its initial state by deleting the storage directory before importing the saved entities.

 

Import Extension

  1. In the lower left corner, click Import/Export, then select Import.

    select_import.png
    NOTE: The build produces a zip file in ProjectName->build->distributions folder. This zip file will be required for importing the extension.

  2. For the Import Option option, select Extension.

    import_modal.png
  3. Click Browse and choose the zip file in the distributions folder (located in the Exclipse Project's build directory). Click Import.

 

Create a Thing

 

  1. Create a Thing using the ThingWorx Composer with the Thing Template set to the WeatherThingTemplate.


    WeatherThing.png

     

     
  2. Open the ConfigurationTable tab and add the appid from the OpenWeatherMap.org site.

    WeatherThing-config.jpg

     

  3. Open the WeatherAppMashup Mashup by searching for WeatherAppMashup in the Search bar.

    WeatherAppMashupFilter.png

     

  4. Click View Mashup in the WeatherAppMashup Mashup window.

  5. Type the name of a city (eg. Boston) and click go.

    mashup.jpg

     
    NOTE: You can now see the current temperature reading and weather description of your city in the Mashup.

 

Troubleshooting

 

If your import did not get through with the two green checks, you may want to modify your metadata.xml or java code to fix it depending on the error shown in the logs.

 

IssueSolution
JAR Conflict arises between two similar jarsJAR conflicts arise when a similar jar is already present in the Composer database. Try to remove the respective jar resources from the metadata.xml. Add these jars explicitly in twx-lib folder in the project folder inside the workspace directory. Now, build the project and import the extension in ThingWorx Composer once again.
JAR is missingAdd the respective jar resource in metadata.xml using the ThingWorx->New Jar Resource. Now, build the project and import the extension in ThingWorx Composer once again.
Minimum Thingworx Version [ 7.2.1] requirements are not met because current version is: 7.1.3The version of SDK you have used to build your extension is higher than the version of the ThingWorx Composer you are testing against. You can manually edit the configfiles->metadata.xml file to change the Minimum ThingWorx version to your ThingWorx Composer version.

 

Step 13: Next Steps 

 

Congratulations! You've successfully completed the Create an Extension tutorial, and learned how to:

 

  • Install the Eclipse Plugin and Extension SDK
  • Create and configure an Extension project
  • Create Services, Events and Subscriptions
  • Add Composer entities
  • Build and import an Extension

 

Learn More

We recommend the following resources to continue your learning experience:"

CapabilityGuide
BuildApplication Development Tips & Tricks

Additional Resources

If you have questions, issues, or need additional information, refer to:

ResourceLink
CommunityDeveloper Community Forum
SupportExtension Development Guide
Comments

I am not able to build this project at the build step of this tutorial.

Im having gradle installed on system and also installed gradle buildship in my eclipse but still not getting option to build with gradle as shown in above images for this tutorial.

I need help on this issue to finish and conclude this tutorial.

gradle build issue.png

Version history
Last update:
‎Nov 11, 2022 05:06 PM
Updated by:
Labels (2)
Contributors