I work in an installed code base with an existing standalone pom.xml.
It is assumed that the child project is called "hive" in the subdirectory with the parent. Note: hive / pom.xml already exists and it works just fine on its own.
So, in the parent pom.xml, I added:
<modules> <module>hive</module> </modules>
The problem is that I basically lose the ability to create a deployed jar from the parent project.
stephenb@gondolin :/shared/git2/etl$ mvn package assembly:single [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error building POM (may not be this project POM). Project ID: com.myco.etl:etl POM Location: /shared/git2/etl/pom.xml Validation Messages: [0] Packaging 'jar' is invalid. Aggregator projects require 'pom' as packaging. Reason: Failed to validate POM for project com.myco.etl:etl at /shared/git2/etl/pom.xml [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.reactor.MavenExecutionException: Failed to validate POM for project com.myco.etl:etl at /shared/git2/etl/pom.xml at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:272) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138) at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
It seems that maven wants me to create a parent pom that basically does nothing but define dependency modules.
Well, I can create a new pom.xml. But what I cannot do is drag and drop existing project files into a new subdirectory.
Is there any way around this? For instance. defining a submodule that lives on the same level (not subdir)? Or any other way to work with an existing dir structure?
thanks
Subsequent actions: based on the input that the module may just be a file in the local directory, I created another zhuk that calls the source one. The original was renamed to pommod.xml, and the new one shown below is called pom.xml.
<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"> <modelVersion>4.0.0</modelVersion> <groupId>com.myco.etl</groupId> <artifactId>etl</artifactId> <name> ETL Helpers</name> <version>1.0.0-SNAPSHOT</version> <packaging>pom</packaging> <modules> <module>appminer</module> <module>pommod.xml</module> </modules>
I ran the mvn compile package. But still getting the same error:
Project ID: com.myco:app_miner POM Location: /shared/git2/etl/mycopom.xml Validation Messages: [0] Packaging 'jar' is invalid. Aggregator projects require 'pom' as packaging. Reason: Failed to validate POM for project com.myco:app_miner at /shared/git2/etl/myco/pom.xml