Alfresco Maven SDK - fails if module version string ends with “-SNAPSHOT”

五迷三道 提交于 2019-12-01 05:46:14

问题


So I created an amp project, both repo and share, and every time I try to build or run the project it fails with:

java.lang.NoClassDefFoundError: de/schlichtherle/truezip/fs/FsSyncExceptionBuilder
    at de.schlichtherle.truezip.fs.FsManager.sync(FsManager.java:99)
    at de.schlichtherle.truezip.fs.FsSyncShutdownHook$Hook.run(FsSyncShutdownHook.java:93)
Caused by: java.lang.ClassNotFoundException: de.schlichtherle.truezip.fs.FsSyncExceptionBuilder
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
    ... 2 more

pom.xml

<project [...]>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.someco</groupId>
    <artifactId>someco-repo</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <name>someco-repo AMP project</name>
    <packaging>amp</packaging>
    [...]
    <parent>
        <groupId>org.alfresco.maven</groupId>
        <artifactId>alfresco-sdk-parent</artifactId>                       
        <version>1.1.1</version> // same with 1.1.0
    </parent>

Changing the module version from 1.0.0-SNAPSHOT to 1.0.0 works, but then I cannot work with snapshots (or at least identify them as -SNAPSHOT).

Any ideas?


回答1:


This should actually work. So I wonder if there's something weird in your env. Any chance you can delete the local copy of that library (~/.m2/repository/de/schlichterle/truezip) and retry?

I wonder if you have a corrupted version.

Sounds weird though that it works when you change the version...




回答2:


I had the same error.

I had at one point run maven as root. I tried removing ~/.m2/repository/de/schlichterle/truezip. This did not help.

I then removed the target directory, which had some files in it owned by the root user. I don't fully understand why this fixed it, but it did.

After running maven again, the ~/.m2/repository/de/schlichterle/truezip directory still does not exist, but apparently it is not needed as everything is working fine.




回答3:


The error log says:

java.lang.NoClassDefFoundError

That means that there is a missing class on your code. You're using Alfresco, then, it means that you have missing dependencies. Jeff Pott's tutorials are a little deprecated now.

You need to add to your pom.xml file, dependencies for truezip, truezip-driver and truezip-file. Then, re-run and it works.




回答4:


You need to add TrueZIP Maven Plugin dependency and its drivers into your pom.xml file, e.g.

...
  <dependencies>
    <dependency>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>truezip-maven-plugin</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>de.schlichtherle.truezip</groupId>
      <artifactId>truezip-driver-file</artifactId>
      <version>7.7.9</version>
    </dependency>
    <dependency>
      <groupId>de.schlichtherle.truezip</groupId>
       <artifactId>truezip-kernel</artifactId>
      <version>7.7.9</version>
    </dependency>
    <dependency>
      <groupId>de.schlichtherle.truezip</groupId>
      <artifactId>truezip-driver-zip</artifactId>
      <version>7.7.9</version>
    </dependency>
  </dependencies>
...

For further debugging, try adding -X flag for your mvn command.




回答5:


When the mapping specified in file-mapping.properties is incorrect (not parsable by alfresco maven) then throws this error.

I am not sure why it is not able to parse the mapping. But it throws error on:

web/=/

but not on:

/web/=/


来源:https://stackoverflow.com/questions/29511318/alfresco-maven-sdk-fails-if-module-version-string-ends-with-snapshot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!