Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven eclipse packaging "pom" not working

I'm using Eclipse Mars (4.5) with Maven 3.3.3.

Recently, I did a Maven update on a project Java 8 (SE), and all of the sudden, Eclipse didn't want the <packaging>jar</packaging> in my pom.xml to be valid, but wanted me to change the packaging to pom. Why can't I leave it to jar ?

Moreover, in the overview, the packaging choice is disabled.

When running maven from console (with jar packaging), this is what I get:

[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Child module C:\Users\Me\workspace\MyProject\? of C:\Users\Me\workspace\MyProject\pom.xml does not exist @
[ERROR] 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. @ line 8, column 13
 @
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] Child module C:\Users\Me\workspace\MyProject\? of C:\Users\Me\workspace\MyProject\pom.xml does not exist @
[ERROR] 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. @ line 8, column 13

        at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:422)
        at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419)
        at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410)
        at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83)
        at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR]
[ERROR]   The project MyProject:model:0.2 (C:\Users\Me\workspace\MyProject\pom.xml) has 2 errors
[ERROR]     Child module C:\Users\Me\workspace\MyProject\? of C:\Users\Me\workspace\MyProject\pom.xml does not exist
[ERROR]     'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. @ line 8, column 13

Can somebody help me ? at least in re-enabling jar packaging. Thanks.

EDIT: Indeed, somehow my pom.xml had some new lines added (I don't know why or how):

<modules>
    <module>?</module>
</modules>

That was what caused the issue. Removing it made the problem go away, thank you !

like image 356
Sylordis Avatar asked Feb 17 '26 02:02

Sylordis


1 Answers

Because if your pom declares modules it is an "aggregator POM" - aggregator modules must be pom. That is why you get the following error in your log:

[ERROR] 'packaging' with value 'jar' is invalid. 
    Aggregator projects require 'pom' as packaging. @ line 8, column 13

You can go back to jar when you remove all the <module> declarations from your pom.

Please refer to the documentation of multi-module projects.

like image 152
rec Avatar answered Feb 19 '26 16:02

rec