When should scripts be put in /src/main/scripts (maven standard) and when not? [closed]
When should scripts be put in /src/main/scripts (maven standard) and when not? [closed]
When should scripts be put in /src/main/scripts (maven standard) and when not? [closed]
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
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
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
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
You can use different executions of the assembly plugin and then attach the resulting assembly to the build. Of course you have to configure different final names for the artifacts in the assembly plugin configuration.
This always works for me: <fileSets> <fileSet> <directory>.</directory> <outputDirectory>logs</outputDirectory> <excludes> <exclude>*/**</exclude> </excludes> </fileSet> </fileSets>
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
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
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.