Create multiple runnable Jars (with dependencies included) from a single Maven project [duplicate]

You can do it. You’ll need a separate execution for each artifact that you’re building (i.e., give each its own id but you can leave the phase as default), and you’ll need to specify the finalName and archive/manifest/mainClass for each. <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <id>build-a</id> <configuration> <archive> <manifest> <mainClass>foobar.Aclass</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> … Read more

Maven: Packaging dependencies alongside project JAR?

I’ve like Maven to package a project with run-time dependencies. This part is unclear (it’s not exactly what you describe just after). My answer covers what you described. I expect it to create a JAR file with the following manifest (…) Configure the Maven Jar Plugin to do so (or more precisely, the Maven Archiver): … Read more

Changing the order of maven plugins execution

Since you say you are very new to Maven….Maven builds are executions of an ordered series of phases. These phases are determined by the lifecycle that is appropriate to your project based on its packaging. Therefore, you control when a plugin’s goal is executed by binding it to a particular phase. Hope that helps. EDIT: … Read more

Maven 2 assembly with dependencies: jar under scope “system” not included

I’m not surprised that system scope dependencies are not added (after all, dependencies with a system scope must be explicitly provided by definition). Actually, if you really don’t want to put that dependency in your local repository (for example because you want to distribute it as part of your project), this is what I would … Read more

Using maven to output the version number to a text file

Sure. Create a text file somewhere in src/main/resources, call it version.txt (or whatever) File content: ${project.version} now in your pom.xml, inside the build element, put this block: <build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <includes> <include>**/version.txt</include> </includes> </resource> <resource> <directory>src/main/resources</directory> <filtering>false</filtering> <excludes> <exclude>**/version.txt</exclude> </excludes> </resource> … </resources> </build> after every build, the file (which you can find … Read more

Building a fat jar using maven

Note: If you are a spring-boot application, read the end of answer Add following plugin to your pom.xml The latest version can be found at … <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>CHOOSE LATEST VERSION HERE</version> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> <executions> <execution> <id>assemble-all</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> </build> … After configuring … Read more

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