Change Server Port in application.yml
... server: port: 8081 ...
Show sql
..... spring: datasource: jpa: show-sql: true properties: hibernate: format_sql: true
Change Server Port in application.yml
... server: port: 8081 ...
Show sql
..... spring: datasource: jpa: show-sql: true properties: hibernate: format_sql: true
settings.xml 里加入
<profiles> <profile> <id>sonar</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <!-- Sonar Host e.g. http://localhost:9000 --> <sonar.host.url> http://localhost:9000 </sonar.host.url> </properties> </profile> </profiles>
Exclusion files in pom.xml
<sonar.exclusions> /usr/file1 /usr/file2 </sonar.exclusions>
Run Sona using maven
mvn clean install sonar:sonar -s /maven/location/settings.xml
chsh -s /bin/bash
kill -9 $(ps aux | grep filename | grep -v grep | awk '{print $2}')
//java code如下
TypedQuery<?> outputSql = entityManager.createQuery(query);
org.eclipse.persistence.sessions.Session session = communityEm.unwrap(org.eclipse.persistence.jpa.JpaEntityManager.class).getActiveSession();
org.eclipse.persistence.queries.DatabaseQuery databaseQuery = outputSql.unwrap(org.eclipse.persistence.jpa.JpaQuery.class).getDatabaseQuery();
databaseQuery.prepareCall(session, new org.eclipse.persistence.sessions.DatabaseRecord());
System.out.println("databaseQuery.getSQLString()"+databaseQuery.getSQLString());
//消除不用的 import classes
Shift+Command + A , then Enter
Control + Shift + O
Control + Shift + F