Imported into the idea of ​​a maven project, everything opened up well. Began to add the third module, does not pick up. Help me find the error in pom.xml it is clearly there.

This is the root:

<project> <modelVersion>4.0.0</modelVersion> <groupId>ru.pravvich</groupId> <artifactId>junior</artifactId> <packaging>pom</packaging> <version>1.0</version> <modules> <module>chapter_001</module> <module>chapter_002</module> <module>chapter_003</module> </modules> </project> 

This is invested in it just chapter_003

 <project> <modelVersion>4.0.0</modelVersion> <groupId>ru.pravvich</groupId> <artifactId>chapter_003</artifactId> <packaging>pom</packaging> <version>1.0</version> <modules> <module>lesson_1</module> </modules> </project> 

Well, the last one that should be collected in jar:

 <project> <modelVersion>4.0.0</modelVersion> <groupId>ru.pravvich</groupId> <artifactId>lesson_1</artifactId> <version>1.0</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-all</artifactId> <version>1.3</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.4.3</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>ru.pravvich</mainClass> </transformer> </transformers> </configuration> </execution> </executions> </plugin> </plugins> </build> </project> 
  • Show the error. - Vladimir Glinskikh Nov.
  • I already created a module named chapter_003 and I wanted to recreate it and now I’m not catching up on the content, so I can’t create a package in it that doesn’t have a class just a simple directory, although it itself is black with chapter_003 in the Maven Progects tab marked as (root) - Pavel Nov.
  • Make Clean, then Install. Show Error what writes. - Vladimir Glinskikh Nov.
  • so the fact of the matter is that everything builds through the terminal, but the idea does not pick up here is the link to the screen s61.radikal.ru/i174/1611/9a/11a9ec5c03ad.png - Pavel

1 answer 1

You have incorrectly configured pom.xml in the module chapter_003, it should be like this:

 <project> <modelVersion>4.0.0</modelVersion> <groupId>ru.pravvich</groupId> <artifactId>chapter_003</artifactId> <packaging>jar</packaging> <version>1.0</version> <parent> <groupId>ru.pravvich</groupId> <artifactId>junior</artifactId> <version>1.0</version> <relativePath>../pom.xml</relativePath> </parent> <build> <finalName>chapter_003</finalName> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> </build> </project> 

After that, you can build the jar file in the console with the mvn clean install command. Also, this module will be automatically enabled when building the root project.