Author: dazarov
Date: 2011-06-08 18:08:31 -0400 (Wed, 08 Jun 2011)
New Revision: 31929
Modified:
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/Seam2FacetInstallDelegateTest.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
Log:
https://issues.jboss.org/browse/JBIDE-8801
Modified:
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2011-06-08
21:36:58 UTC (rev 31928)
+++
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2011-06-08
22:08:31 UTC (rev 31929)
@@ -200,6 +200,7 @@
config.setStringProperty(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME,
"org.test.beans");
config.setStringProperty(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
"noop-connection");
config.setProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH, new String[] {
"noop-driver.jar" });
+ config.setBooleanProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING,
true);
return config;
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/Seam2FacetInstallDelegateTest.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/Seam2FacetInstallDelegateTest.java 2011-06-08
21:36:58 UTC (rev 31928)
+++
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/core/test/project/facet/Seam2FacetInstallDelegateTest.java 2011-06-08
22:08:31 UTC (rev 31929)
@@ -118,6 +118,7 @@
IDataModel dataModel = super.createSeamDataModel(deployType);
dataModel.setStringProperty(
ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, SEAM_2_0_0);
+ dataModel.setBooleanProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING,
true);
return dataModel;
}
@@ -161,7 +162,119 @@
IContainer.class);
assertOnlyContainsTheseFiles(seamgenlibs, warLibs);
}
+
+ public void testWarLibrariesCopying() throws CoreException{
+ checkWarLibrariesInSeamProject("warLibPrj", true);
+ }
+ public void testWarLibrariesNotCopying() throws CoreException{
+ checkWarLibrariesInSeamProject("warNoLibPrj", false);
+ }
+
+ public void testEarLibrariesCopying() throws CoreException{
+ checkEarLibrariesInSeamProject("earLibPrj", true);
+ }
+
+ protected void checkWarLibrariesInSeamProject(String warName, Boolean copyLibraries)
throws CoreException{
+ IDataModel warModel = createSeamDataModel("war");
+ warModel.setBooleanProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING,
copyLibraries);
+
+ IFacetedProject wProject = createSeamProject(warName, warModel);
+ IProject war = wProject.getProject();
+
+ Set<String> onlyInWar = getWarLibs();
+
+ final IContainer warLibs = (IContainer)
war.findMember("WebContent/WEB-INF/lib");
+
+ if(copyLibraries){
+ assertOnlyContainsTheseFiles(onlyInWar, warLibs);
+ }else{
+ assertContainsNoneOfTheseFiles(onlyInWar, warLibs);
+ }
+ }
+
+ protected void checkEarLibrariesInSeamProject(String earName, Boolean copyLibraries)
throws CoreException{
+ IDataModel earModel = createSeamDataModel("ear");
+ earModel.setBooleanProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING,
copyLibraries);
+
+ IFacetedProject eProject = createSeamProject(earName, earModel);
+ IProject war = eProject.getProject();
+
+ SeamProjectsSet seamProjectsSet = new SeamProjectsSet(war);
+
+ assertTrue(seamProjectsSet.getWarProject().exists());
+ assertTrue(seamProjectsSet.getTestProject().exists());
+ assertTrue(seamProjectsSet.getEjbProject().exists());
+ assertTrue(seamProjectsSet.getEarProject().exists());
+
+ IProject ear = seamProjectsSet.getEarProject();
+ IProject ejb = seamProjectsSet.getEjbProject();
+ IProject test = seamProjectsSet.getTestProject();
+
+ Set<String> onlyInWar = getEarWarLibs();
+ Set<String> onlyInEar = getEarLibs();
+ Set<String> onlyInTest = getTestLibs();
+ Set<String> onlyInEarSeam = new HashSet<String>();
+ Set<String> onlyInEjbSrc = new HashSet<String>();
+ Set<String> onlyInEarMeta = new HashSet<String>();
+
+ onlyInEarMeta.add("jboss-app.xml");
+ onlyInEarMeta.add("application.xml");
+
+ onlyInEjbSrc.add("security.drl");
+ onlyInEjbSrc.add("seam.properties");
+ onlyInEjbSrc.add("import.sql");
+ onlyInEjbSrc.add("components.properties");
+
+ onlyInEarSeam.add("jboss-seam.jar");
+
+ if(copyLibraries){
+ onlyInEarSeam.add("lib");
+ onlyInEarSeam.add("META-INF");
+ onlyInEjbSrc.add("META-INF");
+ onlyInEjbSrc.add("org");
+
+ }
+
+ final IContainer earMeta = (IContainer)
ear.findMember("EarContent/META-INF");
+
+ final IContainer warLibs = (IContainer)
war.findMember("WebContent/WEB-INF/lib");
+
+ final IContainer earLibsSeam = (IContainer) ear.findMember("EarContent");
+
+ final IContainer earLibs = (IContainer) ear.findMember("EarContent/lib");
+
+ final IContainer ejbSrc = (IContainer) ejb.findMember("ejbModule");
+
+ final IContainer testLibs = (IContainer) test.findMember("lib");
+
+ if(copyLibraries){
+ assertOnlyContainsTheseFiles(onlyInEjbSrc, ejbSrc);
+
+ assertOnlyContainsTheseFiles(onlyInEarMeta, earMeta);
+
+ assertOnlyContainsTheseFiles(onlyInEarSeam, earLibsSeam);
+
+ assertOnlyContainsTheseFiles(onlyInEar, earLibs);
+
+ assertOnlyContainsTheseFiles(onlyInWar, warLibs);
+
+ assertOnlyContainsTheseFiles(onlyInTest, testLibs);
+ }else{
+ assertContainsNoneOfTheseFiles(onlyInEjbSrc, ejbSrc);
+
+ assertContainsNoneOfTheseFiles(onlyInEarMeta, earMeta);
+
+ assertContainsNoneOfTheseFiles(onlyInEarSeam, earLibsSeam);
+
+ assertContainsNoneOfTheseFiles(onlyInEar, earLibs);
+
+ assertContainsNoneOfTheseFiles(onlyInWar, warLibs);
+
+ assertContainsNoneOfTheseFiles(onlyInTest, testLibs);
+ }
+ }
+
public void testMvelWarJars() {
final IContainer warLibs = (IContainer) warProject.getProject()
.findMember("WebContent/WEB-INF/lib").getAdapter(
@@ -364,6 +477,32 @@
+ " at " + dir.getLocation(), foundFiles.isEmpty());
}
+ protected void assertContainsNoneOfTheseFiles(Set<String> fileNames,
+ final IResource dir) throws CoreException {
+
+ if(dir == null)
+ return;
+
+ final Set<String> foundFiles = new HashSet<String>();
+ dir.accept(new IResourceProxyVisitor() {
+
+ public boolean visit(IResourceProxy proxy) throws CoreException {
+ if (dir.getName().equals(proxy.getName()))
+ return true;
+ foundFiles.add(proxy.getName());
+ return false;
+ }
+
+ }, IResource.DEPTH_ZERO);
+
+ for(String fileName : fileNames){
+ if(foundFiles.contains(fileName)){
+ fail("Found library: "+fileName);
+ }
+ }
+
+ }
+
public void testBootstrapDirPresent() throws CoreException, IOException {
SeamProjectsSet warPs = new SeamProjectsSet(warProject.getProject());
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2011-06-08
21:36:58 UTC (rev 31928)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/ISeamFacetDataModelProperties.java 2011-06-08
22:08:31 UTC (rev 31929)
@@ -305,4 +305,10 @@
String CONFIGURE_WAR_PROJECT = "configure.war.project"; //$NON-NLS-1$
String SEAM_SETTINGS_CHANGED_BY_USER = "seam.settings.changed.by.user";
//$NON-NLS-1$
+
+ /**
+ * This flag indicates that we should copy libraries from Seam Runtime to projects.
+ * Can be "true" or "false".
+ */
+ String SEAM_RUNTIME_LIBRARIES_COPYING = "seam.runtime.libraries.copying";
//$NON-NLS-1$
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2011-06-08
21:36:58 UTC (rev 31928)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2011-06-08
22:08:31 UTC (rev 31929)
@@ -113,7 +113,7 @@
IDataModel model, IProgressMonitor monitor) throws CoreException {
super.doExecuteForEjb(project, fv, model, monitor);
IResource src = getSrcFolder(project);
- if(src!=null && seamHomeFolder!=null) {
+ if(src!=null && seamHomeFolder!=null &&
shouldCopySeamRuntimeLibraries(model)) {
File srcFile = src.getLocation().toFile();
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "security.drl"),
srcFile, false); //$NON-NLS-1$
}
@@ -126,6 +126,9 @@
@Override
protected void copyFilesToWarProject(final IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException {
+ if(!shouldCopySeamRuntimeLibraries(model))
+ return;
+
super.copyFilesToWarProject(project, fv, model, monitor);
final File droolsLibFolder = new File(seamHomePath, DROOLS_LIB_SEAM_RELATED_PATH);
if(isWarConfiguration(model)) {
@@ -153,7 +156,10 @@
* @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#fillEarContents()
*/
@Override
- protected void fillEarContents(IProject project) {
+ protected void fillEarContents(IProject project, IDataModel model) {
+ if(!shouldCopySeamRuntimeLibraries(model))
+ return;
+
if (!SeamCorePlugin.getDefault().hasM2Facet(project)) {
final File droolsLibFolder = new File(seamHomePath, DROOLS_LIB_SEAM_RELATED_PATH);
AntCopyUtils.copyFiles(seamHomeFolder, earContentsFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamHomeFolder)), false);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2011-06-08
21:36:58 UTC (rev 31928)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2011-06-08
22:08:31 UTC (rev 31929)
@@ -89,7 +89,7 @@
@Override
protected void createEarProject() {
super.createEarProject();
- if (!SeamCorePlugin.getDefault().hasM2Facet(seamWebProject)) {
+ if (!SeamCorePlugin.getDefault().hasM2Facet(seamWebProject) &&
shouldCopySeamRuntimeLibraries(model)) {
File earContentsFolder = new File(earProjectFolder, "EarContent");
//$NON-NLS-1$
File earLibFolder = new File(earContentsFolder, "lib"); //$NON-NLS-1$
AntCopyUtils.copyFiles(seamLibFolder, earLibFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(Seam2FacetInstallDelegate.JBOSS_EAR_LIB).dir(seamLibFolder)));
@@ -98,7 +98,7 @@
@Override
protected boolean createTestProject() {
- if(!(Boolean)model.getProperty(ISeamFacetDataModelProperties.TEST_PROJECT_CREATING))
+ if(!(Boolean)model.getProperty(ISeamFacetDataModelProperties.TEST_PROJECT_CREATING) ||
!shouldCopySeamRuntimeLibraries(model))
return false;
File testProjectDir = new
File(seamWebProject.getLocation().removeLastSegments(1).toFile(), testProjectName);
//$NON-NLS-1$
@@ -244,7 +244,8 @@
protected void createEjbProject() {
super.createEjbProject();
// Copy security.drl to source folder
- AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "security.drl"), new
File(ejbProjectFolder, "ejbModule/"), true); //$NON-NLS-1$ //$NON-NLS-2$
+ if(shouldCopySeamRuntimeLibraries(model))
+ AntCopyUtils.copyFileToFolder(new File(seamGenResFolder, "security.drl"),
new File(ejbProjectFolder, "ejbModule/"), true); //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2011-06-08
21:36:58 UTC (rev 31928)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2011-06-08
22:08:31 UTC (rev 31929)
@@ -386,6 +386,9 @@
*/
protected void copyFilesToWarProject(IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException {
+
+ if(!shouldCopySeamRuntimeLibraries(model))
+ return;
final AntCopyUtils.FileSet viewFileSet = new
AntCopyUtils.FileSet(VIEW_FILESET).dir(seamGenViewSource);
AntCopyUtils.copyFilesAndFolders(
@@ -552,28 +555,35 @@
FilterSet earFilterSet = new FilterSet();
earFilterSet.addFilter("projectName", project.getName() + ".ear");
//$NON-NLS-1$ //$NON-NLS-2$
- AntCopyUtils.copyFileToFolder(
- new File(seamGenResFolder, "META-INF/jboss-app.xml"), //$NON-NLS-1$
- metaInfFolder, new FilterSetCollection(earFilterSet), false);
+ if(shouldCopySeamRuntimeLibraries(model)){
+ AntCopyUtils.copyFileToFolder(
+ new File(seamGenResFolder, "META-INF/jboss-app.xml"), //$NON-NLS-1$
+ metaInfFolder, new FilterSetCollection(earFilterSet), false);
+ }
if(applicationXml.exists()) {
configureApplicationXml(project, monitor);
}
- // Copy configuration files from template
- try {
- AntCopyUtils.copyFilesAndFolders(
- new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "ear"),
//$NON-NLS-1$
- earProjectFolder, new FilterSetCollection(ejbFilterSet), false);
- } catch (IOException e) {
- SeamCorePlugin.getPluginLog().logError(e);
+
+ if(shouldCopySeamRuntimeLibraries(model)){
+ // Copy configuration files from template
+ try {
+ AntCopyUtils.copyFilesAndFolders(
+ new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(), "ear"),
//$NON-NLS-1$
+ earProjectFolder, new FilterSetCollection(ejbFilterSet), false);
+ } catch (IOException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
}
- fillEarContents(project);
+ fillEarContents(project, model);
- File resources = new File(earProjectFolder, "resources"); //$NON-NLS-1$
- AntCopyUtils.copyFileToFile(
- dataSourceDsFile, new File(resources, project.getName() + "-ds.xml"),
//$NON-NLS-1$
- viewFilterSetCollection, false);
+ if(shouldCopySeamRuntimeLibraries(model)){
+ File resources = new File(earProjectFolder, "resources"); //$NON-NLS-1$
+ AntCopyUtils.copyFileToFile(
+ dataSourceDsFile, new File(resources, project.getName() + "-ds.xml"),
//$NON-NLS-1$
+ viewFilterSetCollection, false);
+ }
}
protected void configureApplicationXml(IProject project, IProgressMonitor monitor) {
@@ -612,7 +622,7 @@
/**
* Fill ear contents
*/
- abstract protected void fillEarContents(IProject project);
+ abstract protected void fillEarContents(IProject project, IDataModel model);
protected IResource getSrcFolder(IProject project) throws JavaModelException {
IJavaProject javaProject = EclipseResourceUtil.getJavaProject(project);
@@ -661,14 +671,16 @@
viewFilterSetCollection.addFilterSet(projectFilterSet);
File srcFile = src.getLocation().toFile();
- // Copy sources to EJB project in case of EAR configuration
- AntCopyUtils.copyFileToFile(
- new File(seamGenHomeFolder, "src/Authenticator.java"), //$NON-NLS-1$
- new File(srcFile,
model.getProperty(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME).toString().replace('.',
'/') + "/" + "Authenticator.java"), //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
- new FilterSetCollection(filtersFilterSet), false);
+ if(shouldCopySeamRuntimeLibraries(model)){
+ // Copy sources to EJB project in case of EAR configuration
+ AntCopyUtils.copyFileToFile(
+ new File(seamGenHomeFolder, "src/Authenticator.java"), //$NON-NLS-1$
+ new File(srcFile,
model.getProperty(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME).toString().replace('.',
'/') + "/" + "Authenticator.java"), //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
+ new FilterSetCollection(filtersFilterSet), false);
+ }
File persistentXml = new File(srcFile, "META-INF/persistence.xml");
//$NON-NLS-1$
- if(!persistentXml.exists()) {
+ if(!persistentXml.exists() && shouldCopySeamRuntimeLibraries(model)) {
AntCopyUtils.copyFileToFile(persistenceFile, new File(srcFile,
"META-INF/persistence.xml"), //$NON-NLS-1$
viewFilterSetCollection, false);
} else {
@@ -681,10 +693,12 @@
}
AntCopyUtils.FileSet ejbSrcResourcesSet = new
AntCopyUtils.FileSet(JBOOS_EJB_WEB_INF_CLASSES_SET).dir(seamGenResFolder);
- AntCopyUtils.copyFilesAndFolders(seamGenResFolder, srcFile, new
AntCopyUtils.FileSetFileFilter(ejbSrcResourcesSet), viewFilterSetCollection, false);
+ if(shouldCopySeamRuntimeLibraries(model)){
+ AntCopyUtils.copyFilesAndFolders(seamGenResFolder, srcFile, new
AntCopyUtils.FileSetFileFilter(ejbSrcResourcesSet), viewFilterSetCollection, false);
+ }
File ejbJarXml = new File(srcFile, "META-INF/ejb-jar.xml"); //$NON-NLS-1$
- if(!ejbJarXml.exists()) {
+ if(!ejbJarXml.exists() && shouldCopySeamRuntimeLibraries(model)) {
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,
"META-INF/ejb-jar.xml"), //$NON-NLS-1$
new File(srcFile, "META-INF"), viewFilterSetCollection, false);
//$NON-NLS-1$
} else {
@@ -692,13 +706,15 @@
}
}
- AntCopyUtils.copyFileToFile(
- hibernateConsoleLaunchFile,
- new File(ejbProjectFolder, getLaunchCfgName(ejbProjectFolder.getName()) +
".launch"), //$NON-NLS-1$
- new FilterSetCollection(ejbFilterSet), false);
-
- AntCopyUtils.copyFileToFolder(hibernateConsolePropsFile,
- ejbProjectFolder, hibernateDialectFilterSet, false);
+ if(shouldCopySeamRuntimeLibraries(model)){
+ AntCopyUtils.copyFileToFile(
+ hibernateConsoleLaunchFile,
+ new File(ejbProjectFolder, getLaunchCfgName(ejbProjectFolder.getName()) +
".launch"), //$NON-NLS-1$
+ new FilterSetCollection(ejbFilterSet), false);
+
+ AntCopyUtils.copyFileToFolder(hibernateConsolePropsFile,
+ ejbProjectFolder, hibernateDialectFilterSet, false);
+ }
}
enum ProjectType {
@@ -727,11 +743,16 @@
public void doExecute(final IProject project, IProjectFacetVersion fv,
Object config, IProgressMonitor monitor) throws CoreException {
final IDataModel model = (IDataModel)config;
+
IFacetedProject facetedProject = ProjectFacetsManager.create(project);
IProjectFacetVersion ejbVersion =
facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.EJB_FACET);
IProjectFacetVersion webVersion =
facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.DYNAMIC_WEB_FACET);
IProjectFacetVersion earVersion =
facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET);
- IProjectFacetVersion jpaVersion =
facetedProject.getProjectFacetVersion(ProjectFacetsManager.getProjectFacet("jpt.jpa"));
+
+ IProjectFacetVersion jpaVersion = null;
+ if(ProjectFacetsManager.isProjectFacetDefined("jpt.jpa"))
+ jpaVersion =
facetedProject.getProjectFacetVersion(ProjectFacetsManager.getProjectFacet("jpt.jpa"));
+
initDefaultModelValues(model, webVersion!=null);
model.setProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME, project.getName());
@@ -917,6 +938,9 @@
model.setProperty(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
names.get(0));
}
}
+ if(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING)==null)
{
+ model.setBooleanProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING,
true);
+ }
}
/**
@@ -1269,4 +1293,8 @@
}
protected abstract SeamProjectCreator getProjectCreator(IDataModel model, IProject
project);
+
+ protected boolean shouldCopySeamRuntimeLibraries(IDataModel model){
+ return
model.getBooleanProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING);
+ }
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2011-06-08
21:36:58 UTC (rev 31928)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2011-06-08
22:08:31 UTC (rev 31929)
@@ -92,6 +92,7 @@
names.add(ISeamFacetDataModelProperties.CREATE_EAR_PROJECTS);
names.add(CONFIGURE_DEFAULT_SEAM_RUNTIME);
names.add(CONFIGURE_WAR_PROJECT);
+ names.add(ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING);
return names;
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2011-06-08
21:36:58 UTC (rev 31928)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2011-06-08
22:08:31 UTC (rev 31929)
@@ -131,6 +131,10 @@
@Override
protected void copyFilesToWarProject(final IProject project, IProjectFacetVersion fv,
IDataModel model, IProgressMonitor monitor) throws CoreException {
+
+ if(!shouldCopySeamRuntimeLibraries(model))
+ return;
+
super.copyFilesToWarProject(project, fv, model, monitor);
final File droolsLibFolder = new File(seamHomePath, DROOLS_LIB_SEAM_RELATED_PATH);
if (isWarConfiguration(model)) {
@@ -149,7 +153,10 @@
* @see
org.jboss.tools.seam.internal.core.project.facet.SeamFacetAbstractInstallDelegate#fillEarContents()
*/
@Override
- protected void fillEarContents(IProject project) {
+ protected void fillEarContents(IProject project, IDataModel model) {
+ if(!shouldCopySeamRuntimeLibraries(model))
+ return;
+
final File droolsLibFolder = new File(seamHomePath, DROOLS_LIB_SEAM_RELATED_PATH);
AntCopyUtils.copyFiles(seamHomeFolder, earContentsFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamHomeFolder)), false);
AntCopyUtils.copyFiles(seamLibFolder, earContentsFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(JBOSS_EAR_CONTENT).dir(seamLibFolder)), false);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2011-06-08
21:36:58 UTC (rev 31928)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamProjectCreator.java 2011-06-08
22:08:31 UTC (rev 31929)
@@ -267,12 +267,15 @@
});
StringBuffer earJarsStrWar = new StringBuffer();
StringBuffer earJarsStrEjb = new StringBuffer();
- for (File file : earJars) {
- earJarsStrWar.append(" ").append(file.getName()).append(" \n");
- if (isJBossSeamJar(file)) {
- jbossSeamPath = file.getAbsolutePath();
- } else {
- earJarsStrEjb.append(" ").append(file.getName()).append("
\n");
+
+ if(earJars != null){
+ for (File file : earJars) {
+ earJarsStrWar.append(" ").append(file.getName()).append("
\n");
+ if (isJBossSeamJar(file)) {
+ jbossSeamPath = file.getAbsolutePath();
+ } else {
+ earJarsStrEjb.append(" ").append(file.getName()).append("
\n");
+ }
}
}
@@ -283,13 +286,17 @@
FilterSet manifestFilterWar = new FilterSet();
manifestFilterWar.addFilter("earLibs", earJarsStrWar.toString());
//$NON-NLS-1$
manifestFilterColWar.addFilterSet(manifestFilterWar);
- AntCopyUtils.copyFileToFolder(new
File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),
"war/META-INF/MANIFEST.MF"), webMetaInf, manifestFilterColWar, true);
//$NON-NLS-1$
+
+ if(shouldCopySeamRuntimeLibraries(model))
+ AntCopyUtils.copyFileToFolder(new
File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),
"war/META-INF/MANIFEST.MF"), webMetaInf, manifestFilterColWar, true);
//$NON-NLS-1$
FilterSetCollection manifestFilterColEjb = new
FilterSetCollection(projectFilterSet);
FilterSet manifestFilterEjb = new FilterSet();
manifestFilterEjb.addFilter("earClasspath", earJarsStrEjb.toString());
//$NON-NLS-1$
manifestFilterColEjb.addFilterSet(manifestFilterEjb);
- AntCopyUtils.copyFileToFolder(new
File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),
"ejb/ejbModule/META-INF/MANIFEST.MF"), ejbMetaInf, manifestFilterColEjb, true);
//$NON-NLS-1$
+
+ if(shouldCopySeamRuntimeLibraries(model))
+ AntCopyUtils.copyFileToFolder(new
File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),
"ejb/ejbModule/META-INF/MANIFEST.MF"), ejbMetaInf, manifestFilterColEjb, true);
//$NON-NLS-1$
} catch (IOException e) {
SeamCorePlugin.getPluginLog().logError(e);
}
@@ -449,7 +456,7 @@
* Creates test project for given seam web project.
*/
protected boolean createTestProject() {
- if(!(Boolean)model.getProperty(ISeamFacetDataModelProperties.TEST_PROJECT_CREATING))
+ if(!(Boolean)model.getProperty(ISeamFacetDataModelProperties.TEST_PROJECT_CREATING) ||
!shouldCopySeamRuntimeLibraries(model))
return false;
File testProjectDir = new
File(seamWebProject.getLocation().removeLastSegments(1).toFile(), testProjectName);
//$NON-NLS-1$
@@ -541,6 +548,9 @@
}
protected void createEjbProject() {
+ if(!shouldCopySeamRuntimeLibraries(model))
+ return;
+
ejbProjectFolder.mkdir();
AntCopyUtils.copyFilesAndFolders(
@@ -602,6 +612,9 @@
}
protected void createEarProject() {
+ if(!shouldCopySeamRuntimeLibraries(model))
+ return;
+
earProjectFolder.mkdir();
File earContentsFolder = new File(earProjectFolder, "EarContent");
//$NON-NLS-1$
@@ -626,14 +639,14 @@
} catch (IOException e) {
SeamCorePlugin.getPluginLog().logError(e);
}
-
+
// Fill ear contents
AntCopyUtils.copyFiles(seamHomeFolder, earContentsFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(getJbossEarContent()).dir(seamHomeFolder)));
if (!SeamCorePlugin.getDefault().hasM2Facet(seamWebProject)) {
AntCopyUtils.copyFiles(seamLibFolder, earContentsFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(getJbossEarContent()).dir(seamLibFolder)));
AntCopyUtils.copyFiles(droolsLibFolder, earContentsFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(getJbossEarContent()).dir(droolsLibFolder)));
}
- AntCopyUtils.copyFiles(seamGenResFolder, earContentsFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(getJbossEarContent()).dir(seamGenResFolder)));
+ AntCopyUtils.copyFiles(seamGenResFolder, earContentsFolder, new
AntCopyUtils.FileSetFileFilter(new
AntCopyUtils.FileSet(getJbossEarContent()).dir(seamGenResFolder)));
File resources = new File(earProjectFolder, "resources");
AntCopyUtils.copyFileToFile(
@@ -690,4 +703,8 @@
protected void configureJBossAppXml() {
// Do nothing special for Seam 1.2
}
+
+ protected boolean shouldCopySeamRuntimeLibraries(IDataModel model){
+ return
model.getBooleanProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING);
+ }
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2011-06-08
21:36:58 UTC (rev 31928)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2011-06-08
22:08:31 UTC (rev 31929)
@@ -49,11 +49,11 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
import
org.eclipse.wst.common.frameworks.internal.operations.ProjectCreationDataModelProviderNew;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
import org.eclipse.wst.common.project.facet.core.runtime.RuntimeManager;
import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
@@ -76,7 +76,6 @@
import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider;
import org.jboss.tools.seam.ui.SeamUIMessages;
import org.jboss.tools.seam.ui.wizard.SeamFormWizard;
-import org.jboss.tools.seam.ui.wizard.SeamProjectWizard;
import org.jboss.tools.seam.ui.wizard.SeamWizardFactory;
import org.jboss.tools.seam.ui.wizard.SeamWizardUtils;
@@ -311,6 +310,8 @@
SeamCorePlugin.getDefault().getPluginPreferences().setValue(
SeamProjectPreferences.JBOSS_AS_DEFAULT_DEPLOY_AS,
this.jBossAsDeployAsEditor.getValueAsString());
+
+ model.setBooleanProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING,
!isNewProjectWizard());
}
/*
@@ -599,10 +600,6 @@
}
}
- private boolean isNewSeamProjectWizard() {
- return getWizard() == null || getWizard() instanceof SeamProjectWizard;
- }
-
private boolean isNewProjectWizard() {
// ModifyFacetedProjectWizard or NewProjectDataModelFacetWizard
return getWizard() == null