Submitting patch to Electric build

27 views
Skip to first unread message

Alexandre Rusev

unread,
Sep 19, 2018, 8:25:14 AM9/19/18
to electr...@googlegroups.com
Snapshote jar file built with Electric pom.xml is missing slf4j package,
which is referenced by main code.
This patch is adding missed dependency.


The patch is dealing with problem.

Steven, Dmitry review this trivial patch plz.
If it is okay, let me commit it to repository plz.

Alex.
pom-fix-slf5j-missing-in-snapshote-jar.patch

Dmitry Nadezhin

unread,
Sep 19, 2018, 12:36:54 PM9/19/18
to electr...@googlegroups.com
Hi Alex,

When we execute
$ mvn install
with pom.xml before the patch.
maven produces jar file without dependencies:
target/electric-9.08-a-SNAPSHOT.jar 
When we launch it we get an exception because of absent dependecies:
$ java -jar electric-9.08-a-SNAPSHOT.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at com.sun.electric.Launcher.<clinit>(Launcher.java:55)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 1 more

jar with depencecies can be procuced by pom.xml before the patch by a command:
$ mvn assembly:assembly
It produces tatget/electric-9.08-a-SNAPSHOT-jar-with-dependencies.jar
This jar contains necessary dependencies including
org.slf4j.slf4j-api  -   slf4 api
org.slf4j.slf4j-jdk14  - simplie implementation of slf4j-api using JDK classes java.util.logging.*
This command starts Electric succesfully in my environment:
$ java -jar electric-9.08-a-SNAPSHOT-jar-with-dependencies.jar

The suggested patch contains three changes
1) Add dependency with advanced implementationof slf4 api
+         <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>${orgSlf4jVersion}</version>
+        </dependency>      
2) Remove main class from jar without dependencies
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>2.6</version>
-                <configuration>
-                    <archive>
-                        <manifest>
-                            <mainClass>com.sun.electric.Launcher</mainClass>
-                        </manifest>
-                    </archive>
-                </configuration>
-            </plugin>
3) mvn install creates jar with dependency also.
   mvn nassembly:assembly is no more necessary
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                    </execution>
+                </executions>

I agree with the change (3) . An user obtains jar with dependencies automatically
without need to run $ mvn assembly:assembly .

Can you explain why (1) and (2) are necessary ?
Do you need some features form the advanced implementation slf4j-log4j12
which are not available in the simple implementation org.slf4j.slf4j-jdk14 ?
Why do you want to drop manifiest with main calss from jar without dependencies ?

Does pom.xml with only patch (3) works in you environment ?

Best Regards,
  -Dima




--
You received this message because you are subscribed to the Google Groups "Electric VLSI Editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to electricvlsi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dmitry Nadezhin

unread,
Sep 21, 2018, 3:40:03 AM9/21/18
to electr...@googlegroups.com
Alex,

Change (3) in the pom.xml is in the revision 195 of the repository.
Thank you for the contribution !

  -Dima
Reply all
Reply to author
Forward
0 new messages