Bonjour,
je souhaite utiliser maven pour générer un fichier jar, j'aurai pu le faire en ligne de commande sans maven, mais
je souhaite utiliser cette outil car après je vais utiliser spring boot.
Avec visual studio community , j'ai générer le projet maven.
j'ai pris le premier, maven-archtype-quickstart
puis Voici l'application qui ne fait rien du tout juste utiliser awt :
En mode console, je suis à l'intérieur du dossier projet, je souhaite lancer mvn package, mais il m'affiche ceci:
Code java : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package test; import java.awt.*; class First extends Frame { First() { Button b = new Button("bouton App Lourd"); b.setBounds(30, 100, 80, 30);// setting button position add(b);// adding button into frame setSize(300, 300);// frame size 300 width and 300 height setLayout(null);// no layout manager setVisible(true);// now frame will be visible, by default not visible } public static void main(String args[]) { First f = new First(); } }
Que faut t'il que je configure pour obtenir mon fichier jar dans mon dossier target ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 PS C:\Users\PC-HOME\Desktop\app_Lourd> mvn package [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.115 s [INFO] Finished at: 2021-01-04T12:59:04+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\PC-HOME\Desktop\app_Lourd). Please verify you invoked Maven from the correct directory. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
Ca se passe dans mon pom xml ?
le voici:
Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75 <?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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>DevOhkod</groupId> <artifactId>Stephane</artifactId> <version>1.0-SNAPSHOT</version> <name>Stephane</name> <!-- FIXME change it to the project's website --> <url>http://www.example.com</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> </dependencies> <build> <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> <plugins> <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>3.1.0</version> </plugin> <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> </plugin> <plugin> <artifactId>maven-jar-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <artifactId>maven-install-plugin</artifactId> <version>2.5.2</version> </plugin> <plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> </plugin> <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> <plugin> <artifactId>maven-site-plugin</artifactId> <version>3.7.1</version> </plugin> <plugin> <artifactId>maven-project-info-reports-plugin</artifactId> <version>3.0.0</version> </plugin> </plugins> </pluginManagement> </build> </project>
D'ailleur le fichier jar, va t'il fonctionner car j'ai l'habitue d'exécuter un jar pour un serveur en mode web et pas en client lourd ?
il y aura t'il confusion ou conflit pour maven, car j'ai installer le plugin maven avec l'interface visual studio plugin, et j'ai installer
maven en téléchargeant le fichier zip et en y mettant dans le dossier programme file sous windows 10 ?
j'ai fait comme ça car je n'avais pas la commande mvn package .
merci de vos réponses ?
Partager