/** * Test if the project has pom packaging * * @param mavenProject Project to test * @return <code>true</code> if it has a pom packaging; otherwise * <code>false</code> */ protected boolean isMultiModule(MavenProject mavenProject) { return "pom".equals(mavenProject.getPackaging()); }
private String getClassifier(String alias) { String packaging = project.getPackaging(); if ("docker-tar".equalsIgnoreCase(packaging)) { return alias; } else { return "docker" + (alias != null ? "-" + alias : ""); } }
/** * @return True if this project constructs an APK as opposed to an AAR or APKLIB. */ public boolean isAPKBuild( MavenProject project ) { return APK.equals( project.getPackaging() ); } }
public Artifact create( MavenProject project ) { ArtifactHandler handler = getArtifactHandlerManager().getArtifactHandler( project.getPackaging() ); return new DefaultArtifact( project.getGroupId(), project.getArtifactId(), VersionRange.createFromVersion( project.getVersion() ), null, project.getPackaging(), null, handler, false ); }
public String getProjectOutputJarPath() { return Utils.forceSlashOnDir( project.getBuild().getDirectory() ) + project.getBuild().getFinalName() + "." + project.getPackaging(); }
public Artifact create( MavenProject project, String type, String classifier, boolean optional ) { ArtifactHandler handler = getArtifactHandlerManager().getArtifactHandler( type ); return new DefaultArtifact( project.getGroupId(), project.getArtifactId(), VersionRange.createFromVersion( project.getVersion() ), null, project.getPackaging(), null, handler, optional ); }
/** * Deploy the apk built with the current projects to all attached devices and emulators. * Skips other projects in a multi-module build without terminating. * * @throws MojoExecutionException * @throws MojoFailureException */ protected void deployBuiltApk() throws MojoExecutionException, MojoFailureException { if ( project.getPackaging().equals( APK ) ) { File apkFile = new File( targetDirectory, finalName + "." + APK ); deployApk( apkFile ); } else { getLog().info( "Project packaging is not apk, skipping deployment." ); } }
private File ensureThatArtifactFileIsSet(MavenProject project) { Artifact artifact = project.getArtifact(); if (artifact == null) { return null; } File oldFile = artifact.getFile(); if (oldFile != null) { return oldFile; } Build build = project.getBuild(); if (build == null) { return null; } String finalName = build.getFinalName(); String target = build.getDirectory(); if (finalName == null || target == null) { return null; } File artifactFile = new File(target, finalName + "." + project.getPackaging()); if (artifactFile.exists() && artifactFile.isFile()) { setArtifactFile(project, artifactFile); } return null; }
if (!forceMojoExecution && "pom".equals(this.project.getPackaging()))
@SuppressWarnings({ "unchecked" }) @Override public void execute() throws MojoExecutionException, MojoFailureException { if (!CommonUtils.initSaturnHome()) throw new MojoExecutionException("The ${user.home}/.saturn/caches is not exists"); Log log = getLog(); MavenProject project = (MavenProject) getPluginContext().get("project"); String version = getSaturnVersion(project); log.info("Packing the saturn job into a zip file: version:" + version); List<File> runtimeLibFiles = new ArrayList<File>(); List<Artifact> runtimeArtifacts = project.getRuntimeArtifacts(); for (Artifact artifact : runtimeArtifacts) { runtimeLibFiles.add(artifact.getFile()); } runtimeLibFiles.add(new File(project.getBuild().getDirectory(), project.getBuild().getFinalName() + "." + project.getPackaging())); File zipFile = new File(project.getBuild().getDirectory(), project.getArtifactId() + "-" + project.getVersion() + "-" + "app.zip"); try { CommonUtils.zip(runtimeLibFiles, null, zipFile); } catch (Exception e) { e.printStackTrace(); throw new MojoExecutionException("zip " + zipFile + " failed", e); } projectHelper.attachArtifact(project, "zip", "executor", zipFile); }
/** * @throws MojoExecutionException * @throws MojoFailureException */ public void execute() throws MojoExecutionException, MojoFailureException { String packageToUndeploy; if ( project.getPackaging().equals( AndroidExtension.APK ) ) { packageToUndeploy = renameManifestPackage != null ? renameManifestPackage : extractPackageNameFromAndroidManifest( androidManifestFile ); if ( StringUtils.isNotBlank( packageToUndeploy ) ) { undeployApk( packageToUndeploy ); } } else { getLog().info( "Project packaging is not apk, skipping undeployment." ); } } }
@Override public void sessionStarted( ExecutionEvent event ) { if ( logger.isInfoEnabled() && event.getSession().getProjects().size() > 1 ) { infoLine( '-' ); infoMain( "Reactor Build Order:" ); logger.info( "" ); final List<MavenProject> projects = event.getSession().getProjects(); for ( MavenProject project : projects ) { int len = LINE_LENGTH - project.getName().length() - project.getPackaging().length() - 2; logger.info( project.getName() + chars( ' ', ( len > 0 ) ? len : 1 ) + '[' + project.getPackaging() + ']' ); } totalProjects = projects.size(); } }
public void execute() throws MojoExecutionException, MojoFailureException { if ( project.getPackaging().equals( APK ) ) { String packageToUndeploy = renameManifestPackage != null ? renameManifestPackage : extractPackageNameFromAndroidManifest( destinationManifestFile ); if ( StringUtils.isNotBlank( packageToUndeploy ) ) { undeployApk( packageToUndeploy ); } deployBuiltApk(); } else { getLog().info( "Project packaging is not apk, skipping redeployment" ); } }
prefix = chars( '-', Math.max( 0, ( LINE_LENGTH - project.getPackaging().length() - 4 ) / 2 ) ); suffix = chars( '-', Math.max( 0, LINE_LENGTH - project.getPackaging().length() - 4 - prefix.length() ) ); infoMain( prefix + "[ " + project.getPackaging() + " ]" + suffix );
private void validatePrerequisitesForNonMavenPluginProjects( List<MavenProject> projects ) { for ( MavenProject mavenProject : projects ) { if ( !"maven-plugin".equals( mavenProject.getPackaging() ) ) { Prerequisites prerequisites = mavenProject.getPrerequisites(); if ( prerequisites != null && prerequisites.getMaven() != null ) { logger.warn( "The project " + mavenProject.getId() + " uses prerequisites" + " which is only intended for maven-plugin projects " + "but not for non maven-plugin projects. " + "For such purposes you should use the maven-enforcer-plugin. " + "See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html" ); } } } }
buffer.append( ':' ).append( project.getPackaging() ); buffer.append( ':' ).append( project.getVersion() );
private void generateBuildConfig() throws MojoExecutionException { getLog().debug( "Generating BuildConfig file" ); // Create the BuildConfig for our package. String packageName = extractPackageNameFromAndroidManifest( destinationManifestFile ); if ( StringUtils.isNotBlank( customPackage ) ) { packageName = customPackage; } generateBuildConfigForPackage( packageName ); // Skip BuildConfig generation for dependencies if this is an AAR project if ( project.getPackaging().equals( AAR ) ) { return; } // Generate the BuildConfig for any APKLIB and some AAR dependencies. // Need to generate for AAR, because some old AARs like ActionBarSherlock do not have BuildConfig (or R) for ( Artifact artifact : getTransitiveDependencyArtifacts( APKLIB, AAR ) ) { if ( skipBuildConfigGeneration( artifact ) ) { getLog().info( "Skip BuildConfig.java generation for " + artifact.getGroupId() + " " + artifact.getArtifactId() ); continue; } final String depPackageName = extractPackageNameFromAndroidArtifact( artifact ); generateBuildConfigForPackage( depPackageName ); } }
/** * {@inheritDoc} */ @Override public void execute() throws MojoExecutionException, MojoFailureException { if ( project.getPackaging().equals( APK ) ) { try { LauncherInfo launcherInfo; launcherInfo = getLauncherActivity(); ConfigHandler configHandler = new ConfigHandler( this, this.session, this.execution ); configHandler.parseConfiguration(); launch( launcherInfo ); } catch ( Exception ex ) { getLog().info( "Unable to run launcher Activity" ); getLog().debug( ex ); } } else { getLog().info( "Project packaging is not apk, skipping run action." ); } }
final boolean isAarBuild = project.getPackaging().equals( AAR );
if ( ! AndroidExtension.isAndroidPackaging( project.getPackaging() ) )