Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FMCalisto/63a6594dbe3f3ac6a9c5 to your computer and use it in GitHub Desktop.
Save FMCalisto/63a6594dbe3f3ac6a9c5 to your computer and use it in GitHub Desktop.
Setup do projeto )Engenharia de Software, IST, 2016)
# using special INFER_APP_NAME to do just that
appName=INFER_APP_NAME
# FIXME: replace DBASE USER PASSWD
dbAlias=//localhost:3306/DBASE?useUnicode=true&characterEncoding=UTF-8&clobCharacterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
dbUsername=USER
dbPassword=PASSWD
<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>pt.tecnico</groupId>
<artifactId>phonebook</artifactId> <!-- FIXME -->
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Phonebook</name> <!-- FIXME -->
<developers>
<developer> <!-- FIXME: one developer for each team member -->
<id>ist99999</id> <!-- FIXME -->
<name>github username</name> <!-- FIXME -->
<email>[email protected]</email> <!-- FIXME -->
<organization>es16 g99al</organization> <!-- FIXME -->
<roles>
<role>Architect</role>
<role>Developer</role>
<role>Tester</role>
<role>Integrator</role>
</roles>
<properties>
<picUrl>https://fenix.tecnico.ulisboa.pt/user/photo/ist199999</picUrl> <!-- FIXME -->
</properties>
</developer>
</developers>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<fenix.framework.codeGeneratorClassName>pt.ist.fenixframework.backend.jvstmojb.codeGenerator.FenixCodeGeneratorOneBoxPerObject</fenix.framework.codeGeneratorClassName>
<fenix.framework.backend>jvstm-ojb</fenix.framework.backend>
<version.pt.ist.fenix.framework>2.6.0</version.pt.ist.fenix.framework>
<version.junit>4.12</version.junit>
<version.slf4j.api>1.7.7</version.slf4j.api>
<version.ch.qos.logback.logback.classic>1.1.2</version.ch.qos.logback.logback.classic>
<version.org.jdom.jdom>2.0.5</version.org.jdom.jdom>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<verbose>true</verbose>
<fork>true</fork>
</configuration>
</plugin>
<plugin>
<groupId>pt.ist</groupId>
<artifactId>ff-maven-plugin</artifactId>
<version>${version.pt.ist.fenix.framework}</version>
<configuration>
<codeGeneratorClassName>${fenix.framework.codeGeneratorClassName}</codeGeneratorClassName>
</configuration>
<executions>
<execution>
<id>default</id>
<goals>
<goal>ff-generate-domain</goal>
<goal>ff-process-atomic-annotations</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>pt.ist</groupId>
<artifactId>fenix-framework-backend-${fenix.framework.backend}-code-generator</artifactId>
<version>${version.pt.ist.fenix.framework}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>pt.tecnico.phonebook.presentation.PbShell</mainClass> <!-- FIXME -->
<killAfter>-1</killAfter>
</configuration>
</plugin>
</plugins>
<!-- plugin>
<groupId>pt.tecnico.plugin</groupId>
<artifactId>dml2yuml-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<role>false</role>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>dml2yuml</goal>
</goals>
</execution>
</executions>
</plugin -->
</build>
<dependencies>
<dependency>
<groupId>pt.ist</groupId>
<artifactId>fenix-framework-core-api</artifactId>
<version>${version.pt.ist.fenix.framework}</version>
</dependency>
<dependency>
<groupId>pt.ist</groupId>
<artifactId>fenix-framework-core-consistency-predicates</artifactId>
<version>${version.pt.ist.fenix.framework}</version>
</dependency>
<dependency>
<groupId>pt.ist</groupId>
<artifactId>fenix-framework-backend-${fenix.framework.backend}-runtime</artifactId>
<version>${version.pt.ist.fenix.framework}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${version.slf4j.api}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${version.ch.qos.logback.logback.classic}</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>${version.org.jdom.jdom}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.0-rc1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.0-rc1</version>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.21</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>fenixedu-maven-repository</id>
<url>https://repo.fenixedu.org/fenixedu-maven-repository</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>fenixedu-maven-repository</id>
<url>https://repo.fenixedu.org/fenixedu-maven-repository</url>
</pluginRepository>
</pluginRepositories>
</project>
# FIXME: set values for each variable
proj=PROJECT_NAME
main=MAIN_CLASS
user=DATABASE_USERNAME
passwd=DATABASE_PASSWORD
dbase=DATABASE_NAME
# 1) Generic fenix-framework-setup
mvn archetype:generate -DarchetypeGroupId=pt.ist -DarchetypeArtifactId=fenix-framework-application-archetype-clean -DarchetypeVersion=2.0 -DarchetypeRepository=https://fenix-ashes.ist.utl.pt/maven-public -DgroupId=pt.tecnico.dei -DartifactId=$proj -Dversion=1.0-SNAPSHOT -DinteractiveMode=false
cd $proj
# test with: mvn package exec:java -Dexec.mainClass="pt.tecnico.${proj}.Main" clean
# 2) Connect with mysql database
# replace pom.xml by the next file (updating the FIXMEs)
# add fenix-framework-jvstm-ojb.properties file (below) to src/main/resources
# update class name and filename for src/main/java/pt/tecnico/$proj/Main.java with $main
CMD="GRANT ALL PRIVILEGES ON *.* TO '$user'@'localhost' IDENTIFIED BY '$passwd' WITH GRANT OPTION; CREATE DATABASE $dbase;"
mysql -u root -p -e "$CMD"
mvn package exec:java
# verify base table creation with: mysql -u $user --password=$passwd -D $dbase -e "USE $dbase; SHOW TABLES;"
# 3) Setup git
mvn clean
echo -e "target/\n*.class\n*.jar" > .gitignore
echo "add group members (99999 name) and end with EOF in a single line"
# create a README.md file with a short description of the project
git init
git add .
git commit -m "startup"
# 4) Upload to github
git remote add origin [email protected]:$github/${proj}.git
git push -u origin master
# if REPO contains data: git pull origin master
# then push upstream: git push -u origin master
# next pushes use only: git push
# reset(clean) dbase with: mysql -u $user --password=$passwd -D $dbase -e "DROP DATABASE $dbase; CREATE DATABASE $dbase;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment