File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ web : java $JAVA_OPTS -Dspring.profiles.active=" datajpa,heroku" -DTOPJAVA_ROOT=" ." -jar target/dependency/webapp-runner.jar --port $PORT target/* .war
Original file line number Diff line number Diff line change 1+ call mvn -B -s settings.xml -DskipTests=true clean install
2+ call java -Dspring.profiles.active=" datajpa,heroku" -DDATABASE_URL=" postgres://user:password@localhost:5432/topjava" -jar target/dependency/webapp-runner.jar target/*.war
Original file line number Diff line number Diff line change 316316 <activeByDefault >true</activeByDefault >
317317 </activation >
318318 </profile >
319+ <profile >
320+ <id >heroku</id >
321+ <build >
322+ <plugins >
323+ <plugin >
324+ <groupId >org.apache.maven.plugins</groupId >
325+ <artifactId >maven-dependency-plugin</artifactId >
326+ <version >2.10</version >
327+ <executions >
328+ <execution >
329+ <phase >package</phase >
330+ <goals >
331+ <goal >copy</goal >
332+ </goals >
333+ <configuration >
334+ <artifactItems >
335+ <artifactItem >
336+ <groupId >com.github.jsimone</groupId >
337+ <artifactId >webapp-runner</artifactId >
338+ <version >7.0.57.2</version >
339+ <destFileName >webapp-runner.jar</destFileName >
340+ </artifactItem >
341+ </artifactItems >
342+ </configuration >
343+ </execution >
344+ </executions >
345+ </plugin >
346+ </plugins >
347+ </build >
348+ </profile >
319349 </profiles >
320350
321351 <dependencyManagement >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+
3+ <settings xmlns =" http://maven.apache.org/SETTINGS/1.0.0"
4+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
5+ xsi : schemaLocation =" http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" >
6+
7+ <activeProfiles >
8+ <activeProfile >postgres</activeProfile >
9+ <activeProfile >heroku</activeProfile >
10+ </activeProfiles >
11+ </settings >
Original file line number Diff line number Diff line change 1+ jpa.showSql =false
2+ hibernate.format_sql =false
3+ hibernate.use_sql_comments =false
4+ database.init =false
5+ jdbc.initLocation =initDB.sql
Original file line number Diff line number Diff line change 6363 </bean >
6464 </beans >
6565
66+ <beans profile =" heroku" >
67+ <context : property-placeholder location =" classpath:/db/heroku.properties" system-properties-mode =" OVERRIDE" />
68+
69+ <bean class =" java.net.URI" id =" dbUrl" >
70+ <constructor-arg value =" ${DATABASE_URL}" />
71+ </bean >
72+ <bean id =" dataSource"
73+ class =" org.apache.tomcat.jdbc.pool.DataSource" >
74+ <property name =" url" value =" #{ 'jdbc:postgresql://' + @dbUrl.getHost() + @dbUrl.getPath() }" />
75+ <property name =" username" value =" #{ @dbUrl.getUserInfo().split(':')[0] }" />
76+ <property name =" password" value =" #{ @dbUrl.getUserInfo().split(':')[1] }" />
77+ <property name =" driverClassName" value =" org.postgresql.Driver" />
78+ </bean >
79+ </beans >
80+
81+ <!-- Repository implementation-->
6682 <beans profile =" datajpa,jpa" >
6783 <bean id =" entityManagerFactory" class =" org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
6884 p : dataSource-ref =" dataSource"
Original file line number Diff line number Diff line change 1+ java.runtime.version =1.8
You can’t perform that action at this time.
0 commit comments