Package org.apache.maven.bootstrap.util

Examples of org.apache.maven.bootstrap.util.JarMojo


    }

    private File createJar( File pomFile, String classes, String buildDir, Model reader )
        throws Exception
    {
        JarMojo jarMojo = new JarMojo();

        String artifactId = reader.getArtifactId();

        // ----------------------------------------------------------------------
        // Create pom.properties file
        // ----------------------------------------------------------------------

        Properties p = new Properties();

        p.setProperty( "groupId", reader.getGroupId() );

        p.setProperty( "artifactId", reader.getArtifactId() );

        p.setProperty( "version", reader.getVersion() );

        File pomPropertiesDir =
            new File( new File( classes ), "META-INF/maven/" + reader.getGroupId() + "/" + reader.getArtifactId() );

        pomPropertiesDir.mkdirs();

        File pomPropertiesFile = new File( pomPropertiesDir, "pom.properties" );

        OutputStream os = new FileOutputStream( pomPropertiesFile );

        p.store( os, "Generated by Maven" );

        os.close(); // stream is flushed but not closed by Properties.store()

        FileUtils.copyFile( pomFile, new File( pomPropertiesDir, "pom.xml" ) );

        File jarFile = new File( buildDir, artifactId + ".jar" );
        jarMojo.execute( new File( classes ), jarFile );

        return jarFile;
    }
View Full Code Here


    }

    private File createJar( File pomFile, String classes, String buildDir, Model reader )
        throws Exception
    {
        JarMojo jarMojo = new JarMojo();

        String artifactId = reader.getArtifactId();

        // ----------------------------------------------------------------------
        // Create pom.properties file
        // ----------------------------------------------------------------------

        Properties p = new Properties();

        p.setProperty( "groupId", reader.getGroupId() );

        p.setProperty( "artifactId", reader.getArtifactId() );

        p.setProperty( "version", reader.getVersion() );

        File pomPropertiesDir =
            new File( new File( classes ), "META-INF/maven/" + reader.getGroupId() + "/" + reader.getArtifactId() );

        pomPropertiesDir.mkdirs();

        File pomPropertiesFile = new File( pomPropertiesDir, "pom.properties" );

        OutputStream os = new FileOutputStream( pomPropertiesFile );

        p.store( os, "Generated by Maven" );

        os.close(); // stream is flushed but not closed by Properties.store()

        FileUtils.copyFile( pomFile, new File( pomPropertiesDir, "pom.xml" ) );

        File jarFile = new File( buildDir, artifactId + ".jar" );
        jarMojo.execute( new File( classes ), jarFile );

        return jarFile;
    }
View Full Code Here

   * @return jar file
   * @throws Exception the exception
   */
  private File createJar(File pomFile, String classesDir, String buildDir, Model model)
          throws Exception {
    JarMojo jarMojo = new JarMojo();

    String artifactId = model.getArtifactId();

    // ----------------------------------------------------------------------
    // Create pom.properties file
    // ----------------------------------------------------------------------

    Properties p = new Properties();

    p.setProperty("groupId", model.getGroupId());
    p.setProperty("artifactId", model.getArtifactId());
    p.setProperty("version", model.getVersion());

    File pomPropertiesDir =
            new File(new File(classesDir), "META-INF/maven/" + model.getGroupId() + "/" + model.getArtifactId());

    pomPropertiesDir.mkdirs();

    File pomPropertiesFile = new File(pomPropertiesDir, "pom.properties");

    OutputStream os = new FileOutputStream(pomPropertiesFile);

    p.store(os, "Generated by Maven");

    os.close(); // stream is flushed but not closed by Properties.store()

    FileUtils.copyFile(pomFile, new File(pomPropertiesDir, "pom.xml"));

    File jarFile = new File(buildDir, artifactId + ".jar");
    jarMojo.execute(new File(classesDir), jarFile);

    return jarFile;
  }
View Full Code Here

    }

    private File createJar( File pomFile, String classes, String buildDir, ModelReader reader )
        throws Exception
    {
        JarMojo jarMojo = new JarMojo();

        String artifactId = reader.getArtifactId();

        // ----------------------------------------------------------------------
        // Create pom.properties file
        // ----------------------------------------------------------------------

        Properties p = new Properties();

        p.setProperty( "groupId", reader.getGroupId() );

        p.setProperty( "artifactId", reader.getArtifactId() );

        p.setProperty( "version", reader.getVersion() );

        File pomPropertiesDir =
            new File( new File( classes ), "META-INF/maven/" + reader.getGroupId() + "/" + reader.getArtifactId() );

        pomPropertiesDir.mkdirs();

        File pomPropertiesFile = new File( pomPropertiesDir, "pom.properties" );

        OutputStream os = new FileOutputStream( pomPropertiesFile );

        p.store( os, "Generated by Maven" );

        os.close(); // stream is flushed but not closed by Properties.store()

        FileUtils.copyFile( pomFile, new File( pomPropertiesDir, "pom.xml" ) );

        File jarFile = new File( buildDir, artifactId + ".jar" );
        jarMojo.execute( new File( classes ), jarFile );

        return jarFile;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.bootstrap.util.JarMojo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.