IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Build Java Discussion :

commencer lancer le package maven pour obtenir un fichier jar d'exécution ?


Sujet :

Build Java

  1. #1
    Membre éprouvé

    Profil pro
    Inscrit en
    Août 2008
    Messages
    1 222
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2008
    Messages : 1 222
    Par défaut commencer lancer le package maven pour obtenir un fichier jar d'exécution ?
    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
    Nom : maven.png
Affichages : 123
Taille : 29,1 Ko

    puis Voici l'application qui ne fait rien du tout juste utiliser awt :

    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();
        }
    }
    En mode console, je suis à l'intérieur du dossier projet, je souhaite lancer mvn package, mais il m'affiche ceci:

    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
    Que faut t'il que je configure pour obtenir mon fichier jar dans mon dossier target ?
    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 ?

  2. #2
    Membre habitué
    Homme Profil pro
    En transition
    Inscrit en
    Avril 2021
    Messages
    9
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : France, Vendée (Pays de la Loire)

    Informations professionnelles :
    Activité : En transition
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2021
    Messages : 9
    Par défaut
    Salut keokaz,
    le post étant ancien, je me demandais si tu étais toujours interessé par Maven et SpringBoot.

Discussions similaires

  1. Obtenir un fichier .jar à partir d'un fichier .dex
    Par hamzawhy dans le forum Android
    Réponses: 3
    Dernier message: 23/08/2016, 12h59
  2. Script pour ouvrir un fichier jar en mode graphique
    Par stracoma dans le forum Shell et commandes GNU
    Réponses: 8
    Dernier message: 03/04/2016, 13h40
  3. Utliser Maven pour faire un build jar
    Par batou22003 dans le forum Maven
    Réponses: 5
    Dernier message: 08/10/2015, 09h51
  4. commande pour déziper un fichier (.jar)
    Par Javamar dans le forum Général Java
    Réponses: 3
    Dernier message: 07/05/2009, 19h00
  5. Compiler du code pour obtenir un fichier .swf
    Par djamess dans le forum Flash
    Réponses: 4
    Dernier message: 20/01/2009, 10h33

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo