• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
SWT Lab 1
 

SWT Lab 1

on

  • 157 views

 

Statistics

Views

Total Views
157
Views on SlideShare
157
Embed Views
0

Actions

Likes
0
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • http://creativecommons.org/licenses/by-sa/3.0/You are free:to Share — to copy, distribute and transmit the workto Remix — to adapt the workto make commercial use of the workUnder the following conditions:Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).Share Alike — If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.With the understanding that:Waiver — Any of the above conditions can be waived if you get permission from the copyright holder.Public Domain — Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license.Other Rights — In no way are any of the following rights affected by the license:Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations;The author's moral rights;Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.Notice — For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.

SWT Lab 1 SWT Lab 1 Presentation Transcript

  • + Jena and Maven Lab 1
  • + Disclaimer License This work is licensed under the Creative Commons Attribution-Share Alike 3.0 License http://creativecommons.org/licenses/by-sa/3.0/
  • + Quick intro to Maven  Maven’s goal is to simplify the development cycle and to allow the developer to comprehend the complete state of the development in the shortest time. Maven deals with:  Making the build process easy  Providing a uniform build system  Providing quality project information  Providing guidelines for best practices development  Allowing transparent migration to new features
  • + Installing maven First, download Maven and follow the installation instructions. http://maven.apache.org/download.html#Installation After that, type the following in a terminal or in a command prompt: do mvn –version if it works, Maven is ready
  • + Creating a project  mvn archetype:generate -DgroupId=com.mycompany.app DartifactId=my-app -DarchetypeArtifactId=maven-archetypequickstart -DinteractiveMode=false my-app |-- pom.xml `-- src |-- main | `-- java | `-- com | `-- mycompany | `-- app | `-- App.java `-- test `-- java `-- com `-- mycompany `-- app `-- AppTest.java
  • + The POM <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany.app</groupId> <artifactId>my-app</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>Maven Quick Start Archetype</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.2</version> <scope>test</scope> </dependency> </dependencies> </project>
  • + Building a package with embedded dependencies <build> <plugins> Add this to your pom <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>fully.qualified.MainClass</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </plugin> </plugins> </build>
  • + Build and Run mvn assembly:single use this instead of “package” ... [INFO] -----------------------------------------------------------------------[INFO] BUILD SUCCESSFUL [INFO] -----------------------------------------------------------------------[INFO] Total time: 2 seconds [INFO] Finished at: Thu Jul 07 21:34:52 CEST 2011 [INFO] Final Memory: 3M/6M [INFO] -----------------------------------------------------------------------java -cp target/my-app-1.0-SNAPSHOT-jar-with-dependencies.jar com.mycompany.app.App Hello World! Make sure to use the full name of the JAR with all the dependencies (should be several megabytes in size)
  • + Jena and Maven  To develop with Jena simply add the following to your POM’s <dependencies> section <dependency> <groupId>org.apache.jena</groupId> <artifactId>jena-arq</artifactId> <version>2.9.3</version> </dependency>
  • + Lab assignment 1  Make a small program that generates a Jena model for the Books graph (slide 38) and writes the graph into    A RDF/XML file A turtle file The program must  Be done using maven  Include a runnable script to execute it