edgent-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale LaBossiere <dlab...@apache.org>
Subject developing an Edgent app in the new mvn world
Date Wed, 19 Jul 2017 16:52:48 GMT

Hi Chris,

I’ve been playing with what’s needed / desired for creating an Edgent app in the new world.
I wanted to get this out to you ~asap as I’m on vacation next week.

This included identifying what would constitute good pom template info.
I haven’t looked into what it takes to create a new “Edgent quickstart” archetype
but you had mentioned creating one in the past so maybe you could help with that?  :-)

I wanted to support:
    - always write the Edgent app in java8 to be able to use lambdas
    - pom is ~independent of other Edgent runtime noms - parent isn’t edgent-parent/pom
or any of the other edgent noms
    - create a über jar for either of the 3 platforms
    - create a new standalone “application package” for either of the 3 platforms
      An app-pkg.tar contains the non-uber app jar, all of the app’s dependencies, and a
      A new package-app.sh constructs the app-pkg.tar:  see https://paste.apache.org/HyGO
    - the same built non-uber jar can also be used with the get-edgent-jars.sh tooling,
      should that be what the user/deployment needs.
      This flow is still a bit rough with respect to composing the classpath.
      More on this one later.

I’ve tested the above using a HelloEdgent app and IotpQuickstart app.
I’ve haven't completed trying with a Kafka Producer sample (close to SimplePublisherApp.java)
but it already demonstrates that the kafka connector pom isn’t sufficiently “non-transitive”
in its dep decls.

This work should also flow into the Edgent samples I think.
e.g., we release a edgent-samples-source bundle whose pom(s) are similar to the ones
used here / supporting the same scenarios. The samples bundle would also contain
the package-app.sh and get-edgent-jars.sh tools I think.
Again, we would not release pre-built samples bundle/artifacts.

Here’s the workflow…

CLI - create, build, run/package new Edgent app 

Create - eventually using Edgent archetype
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart
    add things noted below to pom (dependencies, properties, runnable jar, uber jar)

    copy “hello edgent” into App.java and tweak package&classname

	mvn clean package -DskipTests    # add -Pplatform-java7 or -Pplatform-android as needed

    - via über jar that was created
	java -jar target/my-app-1.0-SNAPSHOT-uber.jar

    - via standalone “application package”

	# create standalone target/app-pkg.tar    
	package-app.sh   # add  --platform java7 or --platform android as appropriate
	##### copy target/app-pkg.tar to the destination system
	##### to run the app:
	#####     mkdir app-pkg
	#####     tar xf app-pkg.tar -C app-pkg
	#####     (cd app-pkg; ./app-run.sh)

	mkdir SWILL
	cp target/app-pkg.tar SWILL
	mkdir app-pkg
	tar xf app-pkg.tar -C app-pkg
	# switch to j7 to test if appropriate
	#     sh
	#     export JAVA_HOME=`/usr/libexec/java_home -v 1.7`   # on OSX
	#     export PATH=$JAVA_HOME/bin:$PATH
	#     which java
	(cd app-pkg; ./app-run.sh)
Jul 18, 2017 6:23:51 PM org.apache.edgent.runtime.etiao.Executable$1 accept
INFO: No more active user tasks


Here’s what I came up with for additions to the quickstart archetype generated pom.
Maybe you’ll see ways to improve upon it.

Link to just the pom fragment:    https://paste.apache.org/9Dtm
Link to a full pom for the IotpQuickstart app case:  https://paste.apache.org/eqaj

— Dale

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message