How to create a project using maven-archetype-plugin? What is artefactId etc?

mvn archetype:generate command is used to create a project from an existing template. There are several archetype’s defined by many developers and project groups. When you run the command, maven does following things: Downloads maven-archetype-plugin’s latest version. Lists all archetype’s that can be used to create a project from. If you defined an archetype while … Read more

Can I configure multiple plugin executions in pluginManagement, and choose from them in my child POM?

You’re correct, by default Maven will include all of the executions you have configured. Here’s how I’ve dealt with that situation before. <pluginManagement> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>some-maven-plugin</artifactId> <version>1.0</version> <executions> <execution> <id>first-execution</id> <phase>none</phase> <goals> <goal>some-goal</goal> </goals> <configuration> <!– plugin config to share –> </configuration> </execution> <execution> <id>second-execution</id> <phase>none</phase> <goals> <goal>other-goal</goal> </goals> <configuration> <!– plugin config to share … Read more

How to eliminate the “maven-enforcer-plugin (goal “enforce”) is ignored by m2e” warning by eclipse?

The eclipse maven plugin runs a projects pom.xml file in order figure out how the maven project is configured and translate the maven pom.xml configuration into an eclipse configuration. A pom.xml can reference an arbitrary number of maven plugins and each of those plugins has the potential to leak memory, or do things that are … Read more

How to exclude maven dependencies?

You can utilize the dependency management mechanism. If you create entries in the <dependencyManagement> section of your pom for spring-security-web and spring-web with the desired 3.1.0 version set the managed version of the artifact will override those specified in the transitive dependency tree. I’m not sure if that really saves you any code, but it … Read more

IncompatibleClassChangeError: class ClassMetadataReadingVisitor has interface ClassVisitor as super class

This error happens when the loaded class i.e. ClassMetadataReadingVisitor does not respect the contract of inherited abstract class or interface i.e. ClassVisitor. Looks like at load time different versions of the above classes are getting loaded in your case. Seems you have new spring-core jar and old spring-asm jar in your application. ClassMetadataReadingVisitor class is … Read more

How can I write maven build to add resources to classpath?

A cleaner alternative of putting your config file into a subfolder of src/main/resources would be to enhance your classpath locations. This is extremely easy to do with Maven. For instance, place your property file in a new folder src/main/config, and add the following to your pom: <build> <resources> <resource> <directory>src/main/config</directory> </resource> </resources> </build> From now, … Read more

Maven error: Not authorized, ReasonPhrase:Unauthorized

The issue may happen while fetching dependencies from a remote repository. In my case, the repository did not need any authentication and it has been resolved by removing the servers section in the settings.xml file: <servers> <server> <id>SomeRepo</id> <username>SomeUN</username> <password>SomePW</password> </server> </servers> ps: I guess your target is mvn clean install instead of maven install … Read more

Maven 3 – Worth it? [closed]

What’s new in Maven 3? Here is a little compilation of what you can find around the net. Backward compatibility – Maven 3 is backward compatible, that is extremely important (especially for those who experienced the Maven 1 to Maven 2 transition). Versionless parent elements – Maven 3 will remove the need to specify the … Read more

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