Maven best practice for generating multiple jars with different/filtered classes?

The Maven general rule is “one primary artifact per POM” for the sake of modularity and the reasons one shouldn’t break this convention (in general) are very well explained in the How to Create Two JARs from One Project (…and why you shouldn’t) blog post. There are however justified exceptions (for example an EJB project … Read more

maven assembly include the current project jar in the final zip/tar

In <dependencySet> you can exclude the current project jar by saying <useProjectArtifact>false</useProjectArtifact>, but it’s true by default, so it should work. From the warning, it seems that you need to do mvn package first, but due to some internal maven issue, it does not work if you do mvn package and mvn assembly:single in separate … Read more

Maven: Include resources into JAR

The source directories for the resources are not defined correctly in the copy-resources goal configuration. Also, the outputDirectory element puts the resources in the target dir, when target/classes is what gets packaged by default. Try this config: <configuration> <outputDirectory>${basedir}/target/classes</outputDirectory> <includeEmptyDirs>true</includeEmptyDirs> <resources> <resource> <directory>${basedir}/src/main/java/com/test/customize</directory> <filtering>false</filtering> </resource> <resource> <directory>${basedir}/src/main/java/com/test/resources</directory> <filtering>false</filtering> </resource> <resource> <directory>${basedir}/src/main/java/com/test/xml</directory> <filtering>false</filtering> </resource> </resources> </configuration> … Read more

Idea to avoid that spring.handlers/spring.schemas get overwritten when merging multiple spring dependencies in a single jar

I managed to get rid of the bug using the shader plugin instead of the (buggy) assembler plugin: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation=”org.apache.maven.plugins.shade.resource.ManifestResourceTransformer”> <mainClass>at.seresunit.lecturemanager_connector.App</mainClass> </transformer> <transformer implementation=”org.apache.maven.plugins.shade.resource.AppendingTransformer”> <resource>META-INF/spring.handlers</resource> </transformer> <transformer implementation=”org.apache.maven.plugins.shade.resource.AppendingTransformer”> <resource>META-INF/spring.schemas</resource> </transformer> </transformers> </configuration> </execution> </executions> </plugin> I think I found the solution on the springsource … Read more

Creating Two Executable Jars Using maven-assembly-plugin

So as soon as I posted this, I found this thread: Create multiple runnable Jars (with depencies included) from a single Maven project This uses a different approach in that it doesn’t use two profiles, it uses two executions, as such: <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.4</version> <executions> <execution> <id>build-publisher</id> <configuration> <appendAssemblyId>false</appendAssemblyId> <archive> <manifest> <mainClass>fully.qualified.path.Publisher</mainClass> </manifest> </archive> <descriptorRefs> … Read more

Error reading assemblies: No assembly descriptors found

I have been using version 2.3 of maven-assembly-plugin, but I believe the problem is the same: if the assembly configuration is declared inside an execution, it works from mvn package, but does not work from mvn assembly:assembly. The solution I have found is to declare the configuration in the top-level configuration of the plugin, and … Read more

ERROR OS=Windows and the assembly descriptor contains a *nix-specific root-relative-reference (starting with slash) / [duplicate]

simplest solution to prevent that warning is: <fileSets> <fileSet> <directory>src/main/resources</directory> <outputDirectory/> </fileSet> </fileSets> or an other solution is: <fileSets> <fileSet> <directory>src/main/resources</directory> <outputDirectory>./</outputDirectory> </fileSet> </fileSets> and it shows that something should be fixed.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)