Note that building Ptolemy II with Maven requires an Internet
connection. The mvn compile step will download
modules from the net.
These notes are based on Tristan King's work, see his July 21, 2008 ptolemy-hackers post: updates on ptII maven and actor.io work.
http://maven.apache.org/download.html$PTII environment variable.
cd /path/to/working/directory/
git clone --depth=50 --branch=master --single-branch https://github.com/icyphy/ptII
export PTII=/path/to/working/directory/ptII
rm -r $PTII/vendors
bash-3.2$ cd $PTII
bash-3.2$ echo $PTII
/Users/cxh/ptII
bash-3.2$ pwd
/Users/cxh/ptII
If the current working directory is a symbolic link to the actual
directory where $PTII is located, then be sure to change
either $PTII or the current working directory so they
both match.
export MAVEN_OPTS="-Xms512m -Xmx512m -XX:PermSize=48m"
./configure --without-eclipse
FIXME: $PTII/pom.xml needs to be extended
to include support for Eclipse, see below
mvn install:install-file -DgroupId=caltrop -DartifactId=ptCal -Dversion=ptII -Dpackaging=jar -Dfile=$PTII/lib/ptCal.jar mvn install:install-file -DgroupId=chic -DartifactId=chic -Dversion=ptII -Dpackaging=jar -Dfile=$PTII/lib/chic.jar mvn install:install-file -DgroupId=jacl -DartifactId=jacl -Dversion=ptII -Dpackaging=jar -Dfile=$PTII/lib/ptjacl.jar mvn install:install-file -DgroupId=javajoystick -DartifactId=joystick -Dversion=0.7 -Dpackaging=jar -Dfile=$PTII/vendors/misc/joystick/Joystick.jar mvn install:install-file -DgroupId=jna -DartifactId=jna -Dversion=4.0.0-variadic -Dpackaging=jar -Dfile=$PTII/lib/jna.jar mvn install:install-file -DgroupId=jxta -DartifactId=jxtasecurity -Dversion=1.0 -Dpackaging=jar -Dfile=$PTII/vendors/sun/jxta/jxtasecurity.jar mvn install:install-file -DgroupId=kieler -DartifactId=kieler -Dversion=ptII -Dpackaging=jar -Dfile=$PTII/lib/kieler.jar mvn install:install-file -DgroupId=mapss -DartifactId=mapss -Dversion=ptII -Dpackaging=jar -Dfile=$PTII/lib/mapss.jar mvn install:install-file -DgroupId=org.eclipse.jetty -DartifactId=jetty-all -Dversion=8.1.5-v20120716 -Dpackaging=jar -Dfile=$PTII/lib/jetty-all-8.1.5-v20120716.jar mvn install:install-file -DgroupId=PDFRenderer -DartifactId=PDFRenderer -Dversion=ptII -Dpackaging=jar -Dfile=$PTII/lib/PDFRenderer.jar mvn install:install-file -DgroupId=javax.servlet -DartifactId=servlet-api -Dversion=3.0.1 -Dpackaging=jar -Dfile=$PTII/lib/javax.servlet-api-3.0.1.jar mvn install:install-file -DgroupId=soot -DartifactId=sootclasses -Dversion=ptII -Dpackaging=jar -Dfile=$PTII/lib/sootclasses.jar mvn install:install-file -DgroupId=jivesoftware -DartifactId=smack -Dversion=3.0.4 -Dpackaging=jar -Dfile=$PTII/lib/smack.jar mvn install:install-file -DgroupId=org.mobicents.slee.resource.smack -DartifactId=smackx -Dversion=3.0.4 -Dpackaging=jar -Dfile=$PTII/lib/smackx.jar mvn install:install-file -DgroupId=protobuf -DartifactId=protobuf -Dversion=ptII -Dpackaging=jar -Dfile=$PTII/lib/protobuf-java-2.4.1.jar mvn install:install-file -DgroupId=g4ltl -DartifactId=g4ltl -Dversion=ptII -Dpackaging=jar -Dfile=$PTII/lib/g4ltl.jar mvn install:install-file -DgroupId=oscP5 -DartifactId=oscP5 -Dversion=ptII -Dpackaging=jar -Dfile=$PTII/lib/oscP5.jar$PTII/pdb uses db and dbxml, which are basically GPL'd. If you want use ptdb, download db and dbxml from http://www.oracle.com/technology/software/products/berkeley-db/xml/index.html and place them in $PTII/vendors/oracle/, then run:
mvn install:install-file -DgroupId=dbxml -DartifactId=db -Dversion=ptII -Dpackaging=jar -Dfile=$PTII/vendors/oracle/db.jar mvn install:install-file -DgroupId=dbxml -DartifactId=dbxml -Dversion=ptII -Dpackaging=jar -Dfile=$PTII/vendors/oracle/dbxml.jar
cd /path/to/ptII-maven/ mvn compile mvn exec:execNote that
mvn exec:exec requires net access. To run
offline, run: mvn -o exec:exec
run-vergil.sh would look like:
#!/bin/bash .java -classpath $PTII/target/ptII-7.1.devel-SNAPSHOT.jar:~/.m2/repository/caltrop/ptCal/unknown/ptCal-unknown.jar:~/.m2/repository/net/jini/jini-core/2.1/jini-core-2.1.jar:~/.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar:~/.m2/repository/javax/jms/jms/1.1/jms-1.1.jar:~/.m2/repository/jdom/jdom/1.0/jdom-1.0.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/../lib/tools.jar:~/.m2/repository/chic/chic/unknown/chic-unknown.jar:~/.m2/repository/jxta/jxtasecurity/1.0/jxtasecurity-1.0.jar:~/.m2/repository/jxta/jxta/1.0/jxta-1.0.jar:~/.m2/repository/log4j/log4j/1.2.15/log4j-1.2.15.jar:~/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:~/.m2/repository/net/jini/jini-ext/2.1/jini-ext-2.1.jar:~/.m2/repository/jython/jython/svn/jython-svn.jar:~/.m2/repository/java3d/j3d-core/1.3.1/j3d-core-1.3.1.jar:~/.m2/repository/jacl/jacl/ptII/jacl-ptII.jar:~/.m2/repository/colt/colt/1.0.3/colt-1.0.3.jar:~/.m2/repository/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar:~/.m2/repository/javajoystick/joystick/0.7/joystick-0.7.jar:~/.m2/repository/mapss/mapss/unknown/mapss-unknown.jar:~/.m2/repository/javax/mail/mail/1.4/mail-1.4.jar:~/.m2/repository/com/sun/jmx/jmxri/1.2.1/jmxri-1.2.1.jar:~/.m2/repository/java3d/vecmath/1.3.1/vecmath-1.3.1.jar:~/.m2/repository/javax/media/jai_core/1.1.2_01/jai_core-1.1.2_01.jar:~/.m2/repository/soot/sootclasses/ptII/sootclasses-ptII.jar:~/.m2/repository/com/sun/jdmk/jmxtools/1.2.1/jmxtools-1.2.1.jar ptolemy.vergil.VergilApplication
# run these two steps only once cd /path/to/ptII-maven/ mvn package # then /path/to/run-vergil.shNote that the version numbers are hardwired into the path, which is why this file is not checked in. Another issue is that this command build a jar file, which slows down the build/test cycle.
mk/ptcommon.mk includes a rule that will create a ptII/src
directory. The current ptII/pom.xml file does not use this directory,
so there is no need to run make maven[INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking for updates from central [WARNING] repository metadata for: 'artifact org.apache.maven.plugins:maven-resources-plugin' could not be retrieved from repository: central due to an error: Error transferring file [INFO] Repository 'central' will be blacklisted
mvn
compile is run.
~/.m2/repository/org/apache/maven/plugins/maven-resources-plugin
or just remove all of ~/.m2.Missing: ---------- 1) antlr:antlr:jar:2.9.9 Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=antlr -DartifactId=antlr \ -Dversion=2.9.9 -Dpackaging=jar -Dfile=/path/to/file Path to dependency: 1) edu.berkeley.eecs.ptolemy:ptII:jar:7.1.devel-SNAPSHOT 2) antlr:antlr:jar:2.9.9
mvn install:install-file -DgroupId=antlr -DartifactId=antlr -Dversion=svn -Dpackaging=jar -Dfile=$PTII/ptolemy/actor/ptalon/antlr/antlr.jar
Then rerun mvn compile
pom.xml and change the antlr version
number from 2.9.9 to 2.7.7
[INFO] The grammar '/Users/cxh/Documents/workspace/ptII/src/main/antlr/ptolemy/actor/ptalon/parser.g' doesnt exist.
cd $PTII mkdir -p src/main/antlr/ptolemy/actor/ptalon cp $PTII/ptolemy/actor/ptalon/*.g src/main/antlr/ptolemy/actor/ptalonHowever, it turned out that none of the files were being copied because
$PTII was a symbolic link. See below.
Exception in thread "main" java.lang.NoClassDefFoundError: ptolemy/vergil/VergilApplication
$PTII/target/ptII-7.1.devel-SNAPSHOT.jar only
contained the antlr classes. The problem was that the toplevel directory where make maven was run was a symbolic link to the actual $PTII directory. The fix was to make sure that in $PTII, $PTII==pwd:
bash-3.2$ cd $PTII bash-3.2$ echo $PTII /Users/cxh/ptII bash-3.2$ pwd /Users/cxh/ptIIand then to run
make maven mvn compile
/Users/cxh/Documents/workspace/ptII/src/main/java/ptolemy/moml/jxta/JXTALibrary.java:[44,27] package net.jxta.credential does not exist
$PTII/pom.xml and uncomment the jxta section
/Users/cxh/Documents/workspace/ptII/src/main/java/ptolemy/backtrack/eclipse/ast/transform/PackageRule.java:[36,32] package org.eclipse.jdt.core.dom does not exist
mvn -Declipse.workspace=/Applications/eclipse eclipse:add-maven-repo mvn -DeclipseDir=/Applications/eclipse eclipse:to-mavenHowever, the problem is telling Maven where to find the Eclipse jars. One idea would be to add dependencies for each jar via
configure. However, our workaround is to just
not copy the Eclipse plugin files to $PTII/src by
running ./configure --without-eclipse.
/Users/cxh/ptII/ptolemy/backtrack/eclipse/plugin/editor/PtolemyEditor.java:[52,35] cannot find symbol
<properties> <!-- skip test-compile when doing "maven package" --> <maven.test.skip>true</maven.test.skip> </properties>
mvn install webstart:jnlp
maven webstart:jnlp, I get
Embedded error: artifact org.ptolemy:ptII:jar:7.2.devel has no matching file, why? Check the logs...See "3.5.3. Maven Coordinates" of the maven manual, which describes the naming for artifacts. It turns out that the jnlp rule needed to have:
<artifactItems> <artifactItem> <groupId>org.ptolemy</groupId> <artifactId>ptII-7.2.devel.jar</artifactId> <version>7.2.devel</version> <type>jar</type> </artifactItem> </artifactItems>
make maven copy the .java files? This means
that we have yet another copy of the code and that changes to the
master .java files are not propagated?$PTII/pom.xml file lists dev.archer.edu.au
as the repository, this should probably be changed.run-vergil.sh? That
file has version numbers hard coded in.