Adding external library to artifact jar in IntelliJ IDEA

You have 2 options here: extract the dependency into the artifact jar so that the app is the single executable jar with all the dependencies link the dependent jars via the Manifest.MF and copy them near the application main jar I’ve prepared a sample project that demonstrates both approaches: HelloWithDependencies.zip. The artifacts are produced into … Read more

Make Maven to copy dependencies into target/lib

This works for me: <project> … <profiles> <profile> <id>qa</id> <build> <plugins> <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <phase>install</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles> </project>

Get source JARs from Maven repository

Maven Micro-Tip: Get sources and Javadocs When you’re using Maven in an IDE you often find the need for your IDE to resolve source code and Javadocs for your library dependencies. There’s an easy way to accomplish that goal. mvn dependency:sources mvn dependency:resolve -Dclassifier=javadoc The first command will attempt to download source code for each … Read more

Dealing with “Xerces hell” in Java/Maven?

There are 2.11.0 JARs (and source JARs!) of Xerces in Maven Central since 20th February 2013! See Xerces in Maven Central. I wonder why they haven’t resolved https://issues.apache.org/jira/browse/XERCESJ-1454… I’ve used: <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.11.0</version> </dependency> and all dependencies have resolved fine – even proper xml-apis-1.4.01! And what’s most important (and what wasn’t obvious in the … Read more

Maven error “Failure to transfer…”

Remove all your failed downloads: find ~/.m2 -name “*.lastUpdated” -exec grep -q “Could not transfer” {} \; -print -exec rm {} \; For windows: cd %userprofile%\.m2\repository for /r %i in (*.lastUpdated) do del %i Then rightclick on your project in eclipse and choose Maven->”Update Project …”, make sure “Update Dependencies” is checked in the resulting … Read more

org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set

First remove all of your configuration Spring Boot will start it for you. Make sure you have an application.properties in your classpath and add the following properties. spring.datasource.url=jdbc:postgresql://localhost:5432/teste?charSet=LATIN1 spring.datasource.username=klebermo spring.datasource.password=123 spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.jpa.show-sql=false spring.jpa.hibernate.ddl-auto=create If you really need access to a SessionFactory and that is basically for the same datasource, then you can do the following … Read more