Maven: Including jar not found in public repository

You can install the project yourself. Or you can use the system scope like the following: <dependency> <groupId>org.group.project</groupId> <artifactId>Project</artifactId> <version>1.0.0</version> <scope>system</scope> <systemPath>${basedir}/lib/project-1.0.0.jar</systemPath> </dependency> systemPath requires the absolute path of the project. To make it easier, if the jar file is within the repository/project, you can use ${basedir} property, which is bound to the root of … Read more

Maven adding mainClass in pom.xml with the right folder path

First, your main class doesn’t include src/main/java. Look at the package declaration in that Java file. For example, package org.jis;, then add the main class to that. In other words, it’s only org.jis.Main. You need to configure the maven-jar-plugin instead the of the maven-compiler-plugin. The jar-plugin is the one which is responsible for packaging and … Read more

How can I view transitive dependencies of a Maven pom.xml file?

On the CLI, use mvn dependency:tree (Here are some additional Usage notes) When running dependency:tree on multi-module maven project, use mvn compile dependency:tree instead1. Otherwise, the POM Editor in M2Eclipse (Maven integration for Eclipse) is very good, and it includes a hierarchical dependency view. 1If you don’t compile, you might get error Failed to execute … Read more

Maven: Invalid target release: 10

Same problem fixed for me by setting JAVA_HOME environment variable to point to the JDK with right version. My source and destination java version in maven-compiler-plugin were 11, java -version was also on version 11, but my JAVA_HOME was pointing to JDK-1.8. Check JAVA_HOME again by using a terminal instead of IDE: Linux: echo $JAVA_HOME … Read more

Gradle build.gradle to Maven pom.xml

Since Gradle 7, when using Gradle’s Maven-Publish plugin, publishToMavenLocal and publish are automatically added to your tasks, and calling either will always generate a POM file. So if your build.gradle file looks like this: plugins { id ‘java’ id ‘maven-publish’ } repositories { mavenCentral() } dependencies { implementation group: ‘org.slf4j’, name: ‘slf4j-api’, version: ‘1.7.25’ runtimeOnly … Read more

Meaning of ${project.basedir} in pom.xml

There are a set of available properties to all Maven projects. From Introduction to the POM: project.basedir: The directory that the current project resides in. This means this points to where your Maven projects resides on your system. It corresponds to the location of the pom.xml file. If your POM is located inside /path/to/project/pom.xml then … Read more

repository element was not specified in the POM inside distributionManagement element or in -DaltDep loymentRepository=id::layout::url parameter

You should include the repository where you want to deploy in the distribution management section of the pom.xml. Example: <project xmlns=”http://maven.apache.org/POM/4.0.0″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”> … <distributionManagement> <repository> <uniqueVersion>false</uniqueVersion> <id>corp1</id> <name>Corporate Repository</name> <url>scp://repo/maven2</url> <layout>default</layout> </repository> … </distributionManagement> … </project> See Distribution Management

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