Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emend POM.XML to specify net.sourceforge.schemaspy.Main as the main JAR class #12

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<artifactId>oss-parent</artifactId>
<version>6</version>
</parent>
<groupId>com.wakaleo.schemaspy</groupId>
<groupId>com.wakaleo</groupId>
<artifactId>maven-schemaspy-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>5.0.4-SNAPSHOT</version>
Expand Down Expand Up @@ -131,6 +131,23 @@
</configuration>
</plugin>

<!-- Define the Main class of the output JAR file -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<manifest>
<mainClass>net.sourceforge.schemaspy.Main</mainClass>
</manifest>
<manifestEntries>
<Implementation-Build>${buildNumber}</Implementation-Build>
</manifestEntries>
</archive>
</configuration>
</plugin>

</plugins>
<extensions>
<extension>
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/wakaleo/schemaspy/SchemaSpyReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ public class SchemaSpyReport extends AbstractMavenReport {
*/
private Boolean noHtml;

/**
* Detail of execution logging.
*
* @parameter logLevel
*/
private String logLevel;

/**
* Some databases, like Derby, will crash if you use the old driver object
* to establish a connection (eg "connection = driver.connect(...)"). In
Expand Down Expand Up @@ -441,6 +448,7 @@ protected void executeReport(Locale locale) throws MavenReportException {
addFlagToArguments(argList, "-ahic", allowHtmlInComments);
addFlagToArguments(argList, "-noimplied", noImplied);
addFlagToArguments(argList, "-nohtml", noHtml);
addToArguments(argList, "-loglevel", logLevel);
addFlagToArguments(argList, "-norows", noRows);
addFlagToArguments(argList, "-noviews", noViews);
addFlagToArguments(argList, "-noschema", noSchema);
Expand Down
23 changes: 21 additions & 2 deletions src/main/java/net/sourceforge/schemaspy/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URLDecoder;
import java.sql.DatabaseMetaData;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -1210,7 +1211,25 @@ public boolean isDbHelpRequired() {

public static String getLoadedFromJar() {
String classpath = System.getProperty("java.class.path");
return new StringTokenizer(classpath, File.pathSeparator).nextToken();
String loadedFrom = new StringTokenizer(classpath, File.pathSeparator).nextToken();
String path = Config.class.getProtectionDomain().getCodeSource().getLocation().getPath();
String decodedPath = null ;
try {
decodedPath = URLDecoder.decode(path, "UTF-8");
}
catch (java.io.UnsupportedEncodingException uee) {
System.err.println("Unsupported UTF-8 encoding exception caught processing path = \""
+ "\" - defaulting to first classpath element"
);
decodedPath = loadedFrom ;
}
System.err.println("classpath="+classpath);
System.err.println("loadedFrom="+loadedFrom);
System.err.println("path="+path);
System.err.println("decodedPath="+decodedPath);
return decodedPath ;
//return loadedFrom ;
//return new StringTokenizer(classpath, File.pathSeparator).nextToken();
}

/**
Expand Down Expand Up @@ -1718,4 +1737,4 @@ public List<String> asList() throws IOException {

return params;
}
}
}