Wrote my first client server application. I collected it through the IDE. Third-party libraries are not used. Everything works without problems. I decided to redo the application and simplify it using libraries. Started studying Maven. Wrote a pom.xml file. The jar file is generated, but the program does not work. I sin on the correctness of writing pom.xml. The question that has become at the moment. I can not figure out with the architects. I understand these patterns. But how to choose the right, where are their descriptions?

Link to the project: https://github.com/OnlyTarg/WIW-Server

here is my pom.xml:

<?xml version="1.0" encoding="UTF-8"?> <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <groupId>ONLYTARG</groupId> <artifactId>WIWServer</artifactId> <packaging>jar</packaging> <version>0.0.1</version> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.6.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.8.2</version> </dependency> </dependencies> </project> 
  • 2
    You can not figure it out - do not use archetypes. Create your pom.xml manually and that's it. - Alex Chermenin
  • Give your pom.xml and project structure - Nikolay

1 answer 1

Understood. In short, as the architects wrote, they were not useful to me. Long picked the POM.XML file. Re-read a bunch of articles. Who is just starting to learn maven here are a couple of articles - here , here and here .

It really worked, after successively performing the steps indicated in the following article on the new project (then I just copied pom.xml and corrected the encoding errors and added dependencies): https://devcolibri.com/%D0%BA%D0%B0% D0% BA-% D1% 81% D0% BE% D0% B7% D0% B4% D0% B0% D1% 82% D1% 8C-jar-% D1% 84% D0% B0% D0% B9% D0% BB% D0% B0-% D0% B2-maven /

  <?xml version="1.0" encoding="UTF-8"?> <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.Pav.Avdonin</groupId> <artifactId>PContol</artifactId> <packaging>jar</packaging> <version>1.0</version> <name>PControl</name> <url>http://maven.apache.org</url> <properties> <jdk.version>1.8</jdk.version> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>${jdk.version}</source> <target>${jdk.version}</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <configuration> <archive> <manifest> <mainClass>Main</mainClass> </manifest> </archive> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.8.2</version> </dependency> </dependencies> </project>