History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: APF-937
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Matt Raible
Reporter: Sam Imari
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
AppFuse

mvn appfuse:full-source -> IllegalArgumentException if not using default repository location.

Created: 11/Oct/07 02:18 PM   Updated: 03/May/08 11:04 PM
Component/s: Tools - AMP
Affects Version/s: 2.0 Final
Fix Version/s: 2.0.2

Environment:
Windows 2000
cygwin
JDK 1.6.0_03 or JDK 1.5.0_06
Maven 2.0.7
fresh maven repository


 Description  « Hide
When having <localRepository>not default path to repository</localRepository> in maven settings.xml
appfuse:full-source failes with IllegalArgumentException

$ mvn -e appfuse:full-source
Listening for transport dt_socket at address: 4000
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'appfuse'.
[INFO] ----------------------------------------------------------------------------
[INFO] Building AppFuse JSF Application
[INFO] task-segment: [appfuse:full-source]
[INFO] ----------------------------------------------------------------------------
[WARNING] POM for 'org.hibernate:jtidy:pom:r8-20060801:runtime' is invalid. It will be ignored for artifact resolution. Reason: Parse error reading PO
M. Reason: TEXT must be immediately followed by END_TAG and not START_TAG (position: START_TAG seen ...<licenses>\n\t\t\t<license>... @12:13) for project org.hibernate:jtidy at E:\java\maven_repository\org\hibernate\jtidy\r8-20060801\jtidy-r8-20060801.pom
[INFO] [appfuse:full-source]
[INFO] [AppFuse] Installing source from data modules...
[INFO] [AppFuse] Installing source from service module...
[INFO] [AppFuse] Installing source from web-common module...
[INFO] [AppFuse] Installing source from jsf module...
[INFO] [AppFuse] Source successfully exported, modifying pom.xml...
[INFO] [AppFuse] Removing maven-warpath-plugin...
[INFO] [AppFuse] Adding dependencies from root module...
java.lang.IllegalArgumentException: When not aligning with a user install you must specify a local repository location using the setLocalRepositoryDir
ectory( File ) method.
        at org.apache.maven.embedder.MavenEmbedder.createMavenSettings(MavenEmbedder.java:699)
        at org.apache.maven.embedder.MavenEmbedder.start(MavenEmbedder.java:628)
        at org.appfuse.mojo.installer.InstallSourceMojo.createProjectFromPom(InstallSourceMojo.java:706)
        at org.appfuse.mojo.installer.InstallSourceMojo.addModuleDependencies(InstallSourceMojo.java:662)
        at org.appfuse.mojo.installer.InstallSourceMojo.addModuleDependencies(InstallSourceMojo.java:629)
        at org.appfuse.mojo.installer.InstallSourceMojo.execute(InstallSourceMojo.java:225)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] null
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NullPointerException
        at org.appfuse.mojo.installer.InstallSourceMojo.addModuleDependencies(InstallSourceMojo.java:664)
        at org.appfuse.mojo.installer.InstallSourceMojo.addModuleDependencies(InstallSourceMojo.java:629)
        at org.appfuse.mojo.installer.InstallSourceMojo.execute(InstallSourceMojo.java:225)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 44 seconds
[INFO] Finished at: Thu Oct 11 13:27:32 CEST 2007
[INFO] Final Memory: 9M/63M
[INFO] ------------------------------------------------------------------------


 All   Comments   Change History   FishEye      Sort Order:
Patrick Turcotte - 17/Nov/07 08:21 AM
Making sure the folder %USER_HOME%/.m2/repository exists seems to fix this problem.

Matt Raible - 19/Mar/08 01:02 AM
From an e-mail I received:

Configuration:
Using AF 2.0.1 on win xp
 
mvn archetype:create -DarchetypeGroupId=org.appfuse.archetypes \
    -DarchetypeArtifactId=appfuse-modular-struts -DremoteRepositories=http://static.appfuse.org/releases \
    -DarchetypeVersion=2.0.1 -DgroupId=com.core.app -DartifactId=magic2

Project created successfully.
Then executed: mvn -X appfuse:full-source

And it failed with exception shown below.

More details:
Using win xp and ant 1.7.
As the mavn repo was in c:\Documents and Settings\rajeev\.m2\repository, ant failed as it didn't expect a " " in file names.
Following Simon's suggestion: http://www.nabble.com/appsuse-2.0.1-source-code-dowload-td15124097s2369.html
and shifting the repo to C:\dev\.m2\repository (name with no spaces), maven embedder threw this error.

Error msg:
[INFO] [AppFuse] Adding dependencies from root module java.lang.IllegalArgumentException:
When not aligning with a user install you must specify a local repository location using the setLocalRepositoryDirectory( File ) method.
Detailed logs attached below.

The error is not with Appfuse but with maven embedder as it didn't recognize correctly that mvn is not setup in default directory.

The fact that error seems to be coming from executing Appfuse maven plugin led me to wrong trail ;)

BUG FIX: refer Dror Bereznitsky's comment in http://www.jfrog.org/jira/browse/MDV-51
I tested fix with SVN 2.0.1 tag and below mentioned code change.
Sources are generated correctly.

I compiled with the code change and ti worked fine. The maven repo was in a dir with name having no spaces.
What i couldn't test was whether the fix works if maven repo is in default location (i.e. having a space in name.)
As Ant 1.7 fails in between.

Secondly, i am not sure if appfuse code initializes the local repo as per Dror Bereznitsky's comment (http://www.jfrog.org/jira/browse/MDV-51)


CODE CHANGE:
APPFUSE_201/plugins/appfuse-maven-plugin/plugins/appfuse-maven-plugin/src/main/java/org/appfuse/mojo/installer/InstallSourceMojo.java
Method name: createProjectFromPom() line 698.

Added
//CODE SNIPPET START -----------------------
            maven.setAlignWithUserInstallation(true);
//CODE SNIPPET END ------------------------------


final code is:

        try {
            maven.setAlignWithUserInstallation(true); //this line of code added.
            maven.start();
            p = maven.readProjectWithDependencies(pom);
    ........


Failure logs:

[DEBUG] Configuring mojo 'org.codehaus.mojo:appfuse-maven-plugin:2.0.1:full-sour
ce' -->
[DEBUG] (f) destinationDirectory = c:\dev\workspace\appfuse\magic2/src
[DEBUG] (f) project = MavenProject: com.coreobjects.app:magic2:1.0-SNAPSHOT @
c:\dev\workspace\appfuse\magic2\pom.xml
[DEBUG] (f) tag = trunk/
[DEBUG] (f) trunk = https://appfuse.dev.java.net/svn/appfuse/
[DEBUG] -- end configuration --
[INFO] [appfuse:full-source]
[INFO] [AppFuse] Source successfully exported, modifying pom.xml...
[INFO] [AppFuse] Removing maven-warpath-plugin...
[INFO] [AppFuse] Adding dependencies from root module...
java.lang.IllegalArgumentException: When not aligning with a user install you mu
st specify a local repository location using the setLocalRepositoryDirectory( Fi
le ) method.
        at org.apache.maven.embedder.MavenEmbedder.createMavenSettings(MavenEmbe
dder.java:699)
        at org.apache.maven.embedder.MavenEmbedder.start(MavenEmbedder.java:628)

        at org.appfuse.mojo.installer.InstallSourceMojo.createProjectFromPom(Ins
tallSourceMojo.java:698)
        at org.appfuse.mojo.installer.InstallSourceMojo.addModuleDependencies(In
stallSourceMojo.java:654)
        at org.appfuse.mojo.installer.InstallSourceMojo.addModuleDependencies(In
stallSourceMojo.java:621)
        at org.appfuse.mojo.installer.InstallSourceMojo.execute(InstallSourceMoj
o.java:215)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:447)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
Goal(DefaultLifecycleExecutor.java:493)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:463)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:311)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] null
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
java.lang.NullPointerException
        at org.appfuse.mojo.installer.InstallSourceMojo.addModuleDependencies(In
stallSourceMojo.java:656)
        at org.appfuse.mojo.installer.InstallSourceMojo.addModuleDependencies(In
stallSourceMojo.java:621)
        at org.appfuse.mojo.installer.InstallSourceMojo.execute(InstallSourceMoj
o.java:215)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
nManager.java:447)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
ultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone
Goal(DefaultLifecycleExecutor.java:493)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
ltLifecycleExecutor.java:463)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
dleFailures(DefaultLifecycleExecutor.java:311)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
ts(DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
fecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

Taras - 30/Mar/08 05:51 AM
eh...
Looks like this problem will occur to people who moved their local repository from %USER_HOME%\.m2\repository to another place, because %USER_HOME% contains whitespaces.

I dont understant why, but to avoid this error you must keep local repository in two places
1)default folder (%USER_HOME%\.m2\repository)
2)folder path to which doesnt contain whitespaces
in settings.xml you have to link local repository to 2 place.

Matt, why dont you make avaible full sourse download from site?
As you see -there are a lot of troubles with maven etc :(

Matt Raible - 05/Apr/08 10:53 AM
If you modify your settings.xml file (in $M2_HOME), and change localRepository to a DOS path (no spaces), it should solve this issue.

<localRepository>c:\docume~1\yourusername\.m2</localRepository>

oscar - 16/Apr/08 03:09 PM
The eclipse plugin for maven, i.e. mvn eclipse:eclipse and mvn eclipse:eclipse has the same problem than the appfuse plugin. Is this an issue to be tackled down by the plugin or to force to use a repository path without whitespaces?

Matt Raible - 03/May/08 11:04 PM
Thanks for the fix Sam!