Source:
public static void writeToFile(ProductFileConfig productFileConfig, MavenProject mavenProject) throws JAXBException, MojoExecutionException { ProductConfig validatedProductConfig = ProductFileUtils. validateProductConfigForVersionAndFeatureConfig(productFileConfig.getProductConfig(), mavenProject); Product product = new Product(); product.setName(validatedProductConfig.getName()); product.setUid(validatedProductConfig.getUid()); product.setId(validatedProductConfig.getId()); product.setApplication(validatedProductConfig.getApplication()); product.setVersion(validatedProductConfig.getVersion()); product.setUseFeatures(validatedProductConfig.getUseFeatures()); product.setIncludeLaunchers(validatedProductConfig.getIncludeLaunchers()); product.setVersion(validatedProductConfig.getVersion()); product.setConfigIni(validatedProductConfig.getConfigIni()); product.setLauncherArgs(validatedProductConfig.getLauncherArgs()); product.setLauncher(validatedProductConfig.getLauncher()); product.setPlugins(validatedProductConfig.getPlugins()); Features features = new Features(validatedProductConfig.getFeatureConfig()); Configurations configurations = new Configurations(validatedProductConfig.getPluginConfig(), validatedProductConfig.getPropertyConfig()); product.setFeatures(features); product.setConfigurations(configurations); JAXBContext jaxbContext = JAXBContext.newInstance(Product.class); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty("com.sun.xml.internal.bind.xmlHeaders", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?pde version=\"" + productFileConfig.getPdeVersion() + "\"?>"); jaxbMarshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); File productFile = new File(ProductFileUtils. getAbsoluteFilePath(mavenProject), P2Constants.ProductFileDefaults.NAME); jaxbMarshaller.marshal(product, productFile); jaxbMarshaller.marshal(product, System.out); }

Target:
public static void writeToFile(ProductFileConfig productFileConfig, MavenProject mavenProject) throws JAXBException, MojoExecutionException { ProductConfig validatedProductConfig = ProductFileUtils. validateProductConfigForVersionAndFeatureConfig(productFileConfig.getProductConfig(), mavenProject); Product product = new Product(); product.setName(validatedProductConfig.getName()); product.setUid(validatedProductConfig.getUid()); product.setId(validatedProductConfig.getId()); product.setApplication(validatedProductConfig.getApplication()); product.setVersion(validatedProductConfig.getVersion()); product.setUseFeatures(validatedProductConfig.getUseFeatures()); product.setIncludeLaunchers(validatedProductConfig.getIncludeLaunchers()); product.setVersion(validatedProductConfig.getVersion()); product.setConfigIni(validatedProductConfig.getConfigIni()); product.setLauncherArgs(validatedProductConfig.getLauncherArgs()); product.setLauncher(validatedProductConfig.getLauncher()); product.setPlugins(validatedProductConfig.getPlugins()); Features features = new Features(validatedProductConfig.getFeatureConfig()); Configurations configurations = new Configurations(validatedProductConfig.getPluginConfig(), validatedProductConfig.getPropertyConfig()); product.setFeatures(features); product.setConfigurations(configurations); JAXBContext jaxbContext = JAXBContext.newInstance(Product.class); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty("com.sun.xml.bind.xmlHeaders", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?pde version=\"" + productFileConfig.getPdeVersion() + "\"?>"); jaxbMarshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); File productFile = new File(ProductFileUtils. getAbsoluteFilePath(mavenProject), P2Constants.ProductFileDefaults.NAME); jaxbMarshaller.marshal(product, productFile); jaxbMarshaller.marshal(product, System.out); }