Why are Maven generated-sources not getting compiled? [duplicate]

The build-helper plugin indeed solved the problem. Thanks @Joe for the comment. <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>${project.build.directory}/generated-sources/wrappers</source> </sources> </configuration> </execution> </executions> </plugin>

What is the difference between artifactId and groupId in pom.xml?

From maven.apache.org, Naming Conventions: artifactId is the name of the jar without version. If you created it then you can choose whatever name you want with lowercase letters and no strange symbols. If it’s a third party jar you have to take the name of the jar as it’s distributed. eg. maven, commons-math groupId will … Read more

Exclude maven dependency for tests

You could (re)configure the classpath during the test phase thanks to the maven surefire plugin. You can add classpath elements or exclude dependencies. <project> […] <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.12.2</version> <configuration> <additionalClasspathElements> <additionalClasspathElement>path/to/additional/resources</additionalClasspathElement> <additionalClasspathElement>path/to/additional/jar</additionalClasspathElement> </additionalClasspathElements> <classpathDependencyExcludes> <classpathDependencyExclude>org.apache.commons:commons-email</classpathDependencyExclude> </classpathDependencyExcludes> </configuration> </plugin> </plugins> </build> […] </project> As noted by @jFrenetic you could do the same with … Read more

Correct way to declare multiple scope for Maven dependency?

The runtime scope also makes the artifact available on the test classpath. Just use runtime. (See the Maven documentation.) To avoid having the dependency resolved transitively, also make it optional with <optional>true</optional>: <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback</artifactId> <version>0.5</version> <scope>runtime</scope> <optional>true</optional> </dependency>

How to override the `project.build.finalName` Maven property from the command line?

See Introduction to the POM finalName is created as: <build> <finalName>${project.artifactId}-${project.version}</finalName> </build> One of the solutions is to add own property: <properties> <finalName>${project.artifactId}-${project.version}</finalName> </properties> <build> <finalName>${finalName}</finalName> </build> And now try: mvn -DfinalName=build clean package

Maven plugin for Tomcat 9

You can use the plugin to deploy to a separately running tomcat 9. The run goals won’t work, but the deploy goals will. <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <url>http://localhost:8080/manager/text</url> <server>TomcatServer</server> <path>/myapp</path> </configuration> </plugin> Maven goals: mvn tomcat7:deploy mvn tomcat7:undeploy mvn tomcat7:redeploy Note: Don’t forget to add tomcat user in tomcat-users.xml and maven settings.xml tomcat-user.xml <?xml … Read more

How can I use a default value if an environment variable isn’t set for resource filtering in maven?

I’m using the profile for determining as <profiles> <profile> <activation> <activeByDefault>true</activeByDefault> <property> <name>!myproperty</name> </property> </activation> … <properties> <myproperty>some value</myproperty> </properties> </profile> … </profiles> Please note The activeByDefault is set to true with purpose to enable it by default. The !myproperty means this property is missing or not existed. If the myproperty is not existed, just … Read more

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