Class ImportMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
ValidateMojo
@Mojo(name="reify-import",
requiresProject=false)
public class ImportMojo
extends AbstractBaseMojo
To encourage recommended usage, the reify-import goal takes steps to detect local changes
and fail when any are found. Refer to the skipOverwriteProtection
parameter for details. Further, a validation step (optional, see skipValidationOnImport)
attempts to detect commonly found discrepancies
between your MockDataSources and working DataSources.
The Reify for Developers documentation topic contains further discussion around best practices during the design / development cycle.
If you've built your project using one of the Maven archetypes for either SmartGWT or SmartClient, you should have a skeleton configuration in you POM already. if not, add something like the following:
<pluginManagement>
<plugins>
<plugin>
<groupId>com.isomorphic</groupId>
<artifactId>isc-maven-plugin</artifactId>
<version>1.4.5</version>
<!-- the m2pluginextras dependency will be required when skipValidationOnImport = false -->
<dependencies>
<dependency>
<groupId>com.isomorphic.extras</groupId>
<artifactId>isomorphic-m2pluginextras</artifactId>
<version>${smartgwt.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
<build>
<plugins>
<plugin>
<groupId>com.isomorphic</groupId>
<artifactId>isc-maven-plugin</artifactId>
<configuration>
<smartclientRuntimeDir>${project.parent.build.directory}/gwt/launcherDir/myapplication/sc</smartclientRuntimeDir>
<dataSourcesDir>WEB-INF/ds/classic-models</dataSourcesDir>
</configuration>
</plugin>
</plugins>
</build>
and check that the SmartClient runtime has been extracted to the configured location
(via e.g., mvn war:exploded, mvn jetty:run).-
Field Summary
Fields Modifier and Type Field Description protected StringdataSourcesDirThe directory, relative towebappDir), in which your project's working datasources (i.e., other than mocks) reside.protected booleandrawOnWelcomeFilesLikemodifyWelcomeFiles, except this variant will draw the project's first screen when all of its screens have been loaded.protected booleanincludeJsIf true, the import process will *add* JavaScript versions of screens and MockDataSources, translated to JavaScript in the same way that the Isomorphic JSP tag library for screen or DS loading would do it.protected booleanincludeTestHtmlIf true, the import process will create an HTML launcher that loads the given project/s.protected booleanincludeTestJspIf true, the import process will create a JSP launcher that loads the given project/s.protected StringmockDataSourcesDirThe directory, relative towebappDir), in which exported MockDataSources should ultimately reside.protected booleanmodifyWelcomeFilesIf true, the project's welcome files will be modified to include a script block that loads the imported project.protected StringprojectFileDirThe directory to which the exported project file should ultimately reside, relative towebappDir.protected StringprojectNameThe name of the project as it's known by the reify.com environment.protected StringserverIdThe id of a server configuration containing authentication credentials for the Reify site specified byserverUrl, used to download exported projects.protected StringserverUrlThe full URL of the Reify site hosting your project/s.protected booleanskipValidationOnImportWhen true, DataSource validation will be skipped following import.protected FilesmartclientRuntimeDirThe directory containing the Isomorphic runtime.protected StringtestHtmlPathnameThe name (and optional path, relative towebappDir) of the HTML launcher to be created whenincludeTestHtmlis true.protected StringtestJspPathnameThe name (and optional path, relative towebappDir) of the JSP launcher to be created whenincludeTestJspis true.protected StringuiDirThe directory in which exported screens should ultimately reside, relative towebappDir.protected com.isomorphic.util.ErrorMessage.SeverityvalidationFailureThresholdOne of INFO, ERROR, WARN that will determine the level of severity tolerated in any validation error.protected FilewebappDirThe directory containing web application sources.protected FileworkdirThe directory to which the archive is downloaded and unpacked.Fields inherited from class com.isomorphic.maven.mojo.AbstractBaseMojo
artifactResolver, modelBuilder, project, remoteRepositoryManager, repositorySystem, repositorySystemSession, settings -
Constructor Summary
Constructors Constructor Description ImportMojo() -
Method Summary
Modifier and Type Method Description voidexecute()After ensuring there are no local modifications (unless otherwise configured), downloads and installs Reify project contents to the local project environment.protected voidsetCredentials(org.apache.http.auth.UsernamePasswordCredentials credentials)protected voidsetDataSourcesDir(String dataSourcesDir)protected voidsetDrawOnWelcomeFiles(boolean drawOnWelcomeFiles)protected voidsetHost(String uri)protected voidsetIncludeJs(boolean includeJs)protected voidsetIncludeTestHtml(boolean includeTestHtml)protected voidsetIncludeTestJsp(boolean includeTestJsp)protected voidsetMockDataSourcesDir(String mockDataSourcesDir)protected voidsetModifyWelcomeFiles(boolean modifyWelcomeFiles)protected voidsetProjectFileDir(String projectFileDir)protected voidsetProjectFileName(String projectFileName)protected voidsetProjectName(String projectName)protected voidsetProxy(org.apache.maven.settings.Proxy proxy)protected voidsetSkipOverwriteProtection(boolean skipOverwriteProtection)protected voidsetSkipValidationOnImport(boolean skipValidationOnImport)protected voidsetSmartclientRuntimeDir(File smartclientRuntimeDir)protected voidsetTestHtmlPathname(String testHtmlPathname)protected voidsetTestJspPathname(String testJspPathname)protected voidsetUiDir(String uiDir)protected voidsetValidationFailureThreshold(com.isomorphic.util.ErrorMessage.Severity validationFailureThreshold)protected voidsetWebappDir(File webappDir)protected voidsetWorkdir(File workdir)protected voidsetZipFileName(String zipFileName)protected voidvalidate()Compares mock DataSources to live, logging findings and throwing an Exception if and when thevalidationFailureThresholdis exceeded.Methods inherited from class com.isomorphic.maven.mojo.AbstractBaseMojo
getAuthentication, getCredentials
-
Field Details
-
serverUrl
@Parameter(property="serverUrl", defaultValue="https://create.reify.com") protected String serverUrlThe full URL of the Reify site hosting your project/s. Useful when running your own Reify OnSite instance, at e.g., 'http://localhost:8080/create/'.- Since:
- 1.4.2
-
serverId
The id of a server configuration containing authentication credentials for the Reify site specified byserverUrl, used to download exported projects.- Since:
- 1.4.0
-
workdir
@Parameter(property="workdir", defaultValue="${project.build.directory}/reify") protected File workdirThe directory to which the archive is downloaded and unpacked. Note that this is not the final destination of exported assets. For that, seewebappDir.- Since:
- 1.4.0
-
webappDir
@Parameter(property="webappDir", defaultValue="${project.basedir}/src/main/webapp") protected File webappDirThe directory containing web application sources.- Since:
- 1.4.0
-
smartclientRuntimeDir
@Parameter(property="smartclientRuntimeDir", defaultValue="${project.build.directory}/${project.build.finalName}/isomorphic") protected File smartclientRuntimeDirThe directory containing the Isomorphic runtime. The default value is appropriate for the path created by a typical mvn war:exploded invocation. Alternatively, set this to the path created by mvn jetty:run, or any other path where an appropriate SmartClient runtime may be found. Note that SmartGWT users may need to change the value to something like:${project.build.directory}/${project.build.finalName}/${gwtModuleName}/sc- Since:
- 1.4.0
-
includeJs
@Parameter(property="includeJs", defaultValue="false") protected boolean includeJsIf true, the import process will *add* JavaScript versions of screens and MockDataSources, translated to JavaScript in the same way that the Isomorphic JSP tag library for screen or DS loading would do it. These resources have .ui.js and .ds.js extensions respectively.- Since:
- 1.4.5
-
includeTestJsp
@Parameter(property="includeTestJsp", defaultValue="false") protected boolean includeTestJspIf true, the import process will create a JSP launcher that loads the given project/s. The file's name and location can be configured viatestJspPathname.- Since:
- 1.4.0
-
testJspPathname
@Parameter(property="testJspPathname", defaultValue="${projectName}.run.jsp") protected String testJspPathnameThe name (and optional path, relative towebappDir) of the JSP launcher to be created whenincludeTestJspis true.- Since:
- 1.4.0
-
includeTestHtml
@Parameter(property="includeTestHtml", defaultValue="false") protected boolean includeTestHtmlIf true, the import process will create an HTML launcher that loads the given project/s. The file's name and location can be configured viatestHtmlPathname.- Since:
- 1.4.0
-
testHtmlPathname
@Parameter(property="testHtmlPathname", defaultValue="${projectName}.run.html") protected String testHtmlPathnameThe name (and optional path, relative towebappDir) of the HTML launcher to be created whenincludeTestHtmlis true.- Since:
- 1.4.0
-
dataSourcesDir
The directory, relative towebappDir), in which your project's working datasources (i.e., other than mocks) reside.Note that this will need to conform to the webapp's server.properties
project.datasourcesconfiguration.- Since:
- 1.4.0
-
mockDataSourcesDir
@Parameter(property="mockDataSourcesDir", defaultValue="WEB-INF/ds/mock") protected String mockDataSourcesDirThe directory, relative towebappDir), in which exported MockDataSources should ultimately reside.Note that this will need to conform to the webapp's server.properties
project.datasourcesconfiguration.- Since:
- 1.4.0
-
skipValidationOnImport
@Parameter(property="skipValidationOnImport", defaultValue="false") protected boolean skipValidationOnImportWhen true, DataSource validation will be skipped following import. TheValidateMojocan still be executed independently at any time.- Since:
- 1.4.0
-
validationFailureThreshold
@Parameter(property="validationFailureThreshold", defaultValue="ERROR") protected com.isomorphic.util.ErrorMessage.Severity validationFailureThresholdOne of INFO, ERROR, WARN that will determine the level of severity tolerated in any validation error. Any error at or above this threshold will result in "BUILD FAILURE".- Since:
- 1.4.0
-
uiDir
The directory in which exported screens should ultimately reside, relative towebappDir. Note that this will need to conform to the webapp's server.propertiesproject.uiconfiguration.- Since:
- 1.4.0
-
projectFileDir
The directory to which the exported project file should ultimately reside, relative towebappDir. Note that this will need to conform to the webapp's server.propertiesproject.projectconfiguration.- Since:
- 1.4.0
-
modifyWelcomeFiles
@Parameter(property="modifyWelcomeFiles", defaultValue="false") protected boolean modifyWelcomeFilesIf true, the project's welcome files will be modified to include a script block that loads the imported project. Note that the loaded project is not drawn - for that, refer todrawOnWelcomeFiles. Welcome files are determined by scanning the project's web.xml file for the standard welcome-files declaration. If none is found, the webroot is searched for files named index.jsp and index.html.Subsequent imports of other projects append the newly imported project name to the existing one/s.
- Since:
- 1.4.0
-
drawOnWelcomeFiles
@Parameter(property="drawOnWelcomeFiles", defaultValue="false") protected boolean drawOnWelcomeFilesLikemodifyWelcomeFiles, except this variant will draw the project's first screen when all of its screens have been loaded.- Since:
- 1.4.0
-
projectName
@Parameter(property="projectName", defaultValue="${project.artifactId}", required=true) protected String projectNameThe name of the project as it's known by the reify.com environment.- Since:
- 1.4.0
-
-
Constructor Details
-
ImportMojo
public ImportMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureExceptionAfter ensuring there are no local modifications (unless otherwise configured), downloads and installs Reify project contents to the local project environment.- Specified by:
executein interfaceorg.apache.maven.plugin.Mojo- Specified by:
executein classAbstractBaseMojo- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
validate
protected void validate()Compares mock DataSources to live, logging findings and throwing an Exception if and when thevalidationFailureThresholdis exceeded. -
setHost
-
setWorkdir
-
setWebappDir
-
setSmartclientRuntimeDir
-
setIncludeJs
protected void setIncludeJs(boolean includeJs) -
setIncludeTestJsp
protected void setIncludeTestJsp(boolean includeTestJsp) -
setTestJspPathname
-
setIncludeTestHtml
protected void setIncludeTestHtml(boolean includeTestHtml) -
setTestHtmlPathname
-
setDataSourcesDir
-
setMockDataSourcesDir
-
setSkipValidationOnImport
protected void setSkipValidationOnImport(boolean skipValidationOnImport) -
setValidationFailureThreshold
protected void setValidationFailureThreshold(com.isomorphic.util.ErrorMessage.Severity validationFailureThreshold) -
setUiDir
-
setProjectFileDir
-
setModifyWelcomeFiles
protected void setModifyWelcomeFiles(boolean modifyWelcomeFiles) -
setDrawOnWelcomeFiles
protected void setDrawOnWelcomeFiles(boolean drawOnWelcomeFiles) -
setProjectName
-
setProjectFileName
-
setZipFileName
-
setSkipOverwriteProtection
protected void setSkipOverwriteProtection(boolean skipOverwriteProtection) -
setCredentials
protected void setCredentials(org.apache.http.auth.UsernamePasswordCredentials credentials) -
setProxy
protected void setProxy(org.apache.maven.settings.Proxy proxy)
-