Thursday, October 15, 2020

IntelliJ IDEA Shortcuts

 

Format code                              Ctrl + Alt + L

Remove unused imports        CTRL + ALT + O

Tuesday, October 13, 2020

How can I create an executable JAR with dependencies using Maven?

 <build>

  <plugins>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <mainClass>fully.qualified.MainClass</mainClass>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
    </plugin>
  </plugins>
</build>

and you run it with

mvn clean compile assembly:single
https://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven

Tuesday, October 6, 2020

Add Oracle drivers to maven

 Oracle is proprietary solution provider and oracle jars are not available in maven. So we need to manually add those jars to our local maven repository.

One of the errors, you can see is below.

Missing artifact com.oracle:ojdbc6:jar:11.2.0 in pom.xml

<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>

Solution : install manually in maven local local repo, run below command
mvn install:install-file -Dfile={path/to/your/ojdbc.jar} -DgroupId=com.oracle 
-DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

-DgroupId  this may vary, ex: if your group id just "oracle" , you can ommit or empty DgroupId

Then it will looks like below
mvn install:install-file -Dfile={path/to/your/ojdbc.jar} -DgroupId=
-DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar


Thursday, October 1, 2020

Crona - Covid 19 - Trump and First lady, Melania Trump positive for coronavirus

 Today US confirmed, US President, Donald Trump and First Lady, Melania Trump positive for coronavirus.