/** * Adds information about defined profile. * * @param pomDescriptor The descriptor for the current POM. * @param model The Maven Model. * @param scannerContext The scanner context. */ private void addProfiles( MavenPomDescriptor pomDescriptor, Model model, ScannerContext scannerContext) { List<Profile> profiles = model.getProfiles(); Store store = scannerContext.getStore(); for (Profile profile : profiles) { MavenProfileDescriptor mavenProfileDescriptor = store.create(MavenProfileDescriptor.class); pomDescriptor.getProfiles().add(mavenProfileDescriptor); mavenProfileDescriptor.setId(profile.getId()); addProperties(mavenProfileDescriptor, profile.getProperties(), store); addModules(mavenProfileDescriptor, profile.getModules(), store); addPlugins(mavenProfileDescriptor, profile.getBuild(), scannerContext); addManagedPlugins(mavenProfileDescriptor, profile.getBuild(), scannerContext); addManagedDependencies( mavenProfileDescriptor, profile.getDependencyManagement(), scannerContext, ProfileManagesDependencyDescriptor.class); addProfileDependencies(mavenProfileDescriptor, profile.getDependencies(), scannerContext); addActivation(mavenProfileDescriptor, profile.getActivation(), store); } }
/** * Adds activation information for the given profile. * * @param mavenProfileDescriptor The profile descriptor. * @param activation The activation information. * @param store The database. */ private void addActivation( MavenProfileDescriptor mavenProfileDescriptor, Activation activation, Store store) { if (null == activation) { return; } MavenProfileActivationDescriptor profileActivationDescriptor = store.create(MavenProfileActivationDescriptor.class); mavenProfileDescriptor.setActivation(profileActivationDescriptor); profileActivationDescriptor.setJdk(activation.getJdk()); profileActivationDescriptor.setActiveByDefault(activation.isActiveByDefault()); ActivationFile activationFile = activation.getFile(); if (null != activationFile) { MavenActivationFileDescriptor activationFileDescriptor = store.create(MavenActivationFileDescriptor.class); profileActivationDescriptor.setActivationFile(activationFileDescriptor); activationFileDescriptor.setExists(activationFile.getExists()); activationFileDescriptor.setMissing(activationFile.getMissing()); } ActivationOS os = activation.getOs(); if (null != os) { MavenActivationOSDescriptor osDescriptor = store.create(MavenActivationOSDescriptor.class); profileActivationDescriptor.setActivationOS(osDescriptor); osDescriptor.setArch(os.getArch()); osDescriptor.setFamily(os.getFamily()); osDescriptor.setName(os.getName()); osDescriptor.setVersion(os.getVersion()); } ActivationProperty property = activation.getProperty(); if (null != property) { PropertyDescriptor propertyDescriptor = store.create(PropertyDescriptor.class); profileActivationDescriptor.setProperty(propertyDescriptor); propertyDescriptor.setName(property.getName()); propertyDescriptor.setValue(property.getValue()); } }